From: Darrick J. Wong <djwong@xxxxxxxxxx> In step 17 of _test_generic_punch, we want to test that we can write a file with a single block, use one of unresvsp, fpunch, or fzero to modify the file, and then check that the file has one written block followed by a hole. Unfortunately, the test helper uses _get_block_size to determine how much data to write to the test file. For filesystems with an allocation unit size that is not the fs block size (e.g. XFS realtime with a rt extent size), this produces unwritten extents in the fiemap output, which causes test failures. Fix step 17 to obtain the file allocation unit size with _get_file_block_size. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- common/punch | 2 +- tests/generic/153 | 2 +- tests/generic/404 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/punch b/common/punch index b6b8a0b9..4d16b898 100644 --- a/common/punch +++ b/common/punch @@ -480,7 +480,7 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - block_size=`_get_block_size $TEST_DIR` + block_size=`_get_file_block_size $TEST_DIR` $XFS_IO_PROG -f -c "truncate $block_size" \ -c "pwrite 0 $block_size" $sync_cmd \ -c "$zero_cmd 128 128" \ diff --git a/tests/generic/153 b/tests/generic/153 index 40877266..342959fd 100755 --- a/tests/generic/153 +++ b/tests/generic/153 @@ -37,7 +37,7 @@ rm -rf $testdir mkdir $testdir echo "Create the original file blocks" -blksz="$(_get_block_size $testdir)" +blksz="$(_get_file_block_size $testdir)" blks=2000 margin='15%' sz=$((blksz * blks)) diff --git a/tests/generic/404 b/tests/generic/404 index 939692eb..30fce85d 100755 --- a/tests/generic/404 +++ b/tests/generic/404 @@ -69,7 +69,7 @@ _require_test _require_xfs_io_command "falloc" _require_xfs_io_command "finsert" -blksize=`_get_block_size $TEST_DIR` +blksize=`_get_file_block_size $TEST_DIR` # Generate a block with a repeating number represented as 4 bytes decimal. # The test generates unique pattern for each block in order to observe a