summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-19 14:37:44 -0700
committerZorro Lang <zlang@kernel.org>2022-07-24 22:30:58 +0800
commita4acb097a6d1faa484918ea236b6eb437a3ee4cd (patch)
tree475f47578d9c407d86ef27c0198c3f2d46cd92f5
parent181c9826a5b7a3ed638e15857ca2280de320f0c6 (diff)
punch: use allocation unit to test punching holes
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@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/punch2
-rwxr-xr-xtests/generic/1532
-rwxr-xr-xtests/generic/4042
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