summaryrefslogtreecommitdiff
path: root/common/punch
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 /common/punch
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>
Diffstat (limited to 'common/punch')
-rw-r--r--common/punch2
1 files changed, 1 insertions, 1 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" \