generic/{094,225}: skip test when the xfs rt extent size is larger than 1 fsb
authorDarrick J. Wong <djwong@kernel.org>
Wed, 14 Apr 2021 01:05:20 +0000 (18:05 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 18 Apr 2021 12:53:53 +0000 (20:53 +0800)
These two tests call various fallocate modes on a file and compare the
FIEMAP output to some golden output.  Unfortunately, the golden output
doesn't take into account the possibility that (on XFS) the files could be
created on a realtime volume with a large rt extent size set.

Under such a configuration, fpunch operations that are aligned to the fs
block size but not the rt extent size simply result in those blocks
being set to unwritten status.  Unfortunately, the test expects holes
and fails.  Therefore, detect the situation and skip the tests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
tests/generic/094
tests/generic/225

index aa4ea7d4dd7be94144bd5a234006e51d4029a6a0..4d3397d681d3b6ef5f60f69b73aecab1300c945a 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4131,6 +4131,16 @@ _get_block_size()
        stat -f -c %S $1
 }
 
+# Require that the fundamental allocation unit of a file is the same as the
+# filesystem block size.
+_require_file_block_size_equals_fs_block_size()
+{
+       local file_alloc_unit="$(_get_file_block_size $1)"
+       local fs_block_size="$(_get_block_size $1)"
+       test "$file_alloc_unit" != "$fs_block_size" && \
+               _notrun "File allocation unit is larger than a filesystem block"
+}
+
 get_page_size()
 {
        echo $(getconf PAGE_SIZE)
index d371e951a9ef11e132841d5f723b26c54507d0af..8c292473353a18e330a4052b7e7f78048b2efcf9 100755 (executable)
@@ -40,6 +40,11 @@ fiemapfile=$SCRATCH_MNT/$seq.fiemap
 
 _require_test_program "fiemap-tester"
 
+# FIEMAP test doesn't like finding unwritten blocks after it punches out
+# a partial rt extent.
+test "$FSTYP" = "xfs" && \
+       _require_file_block_size_equals_fs_block_size $fiemapfile
+
 seed=`date +%s`
 
 echo "using seed $seed" >> $seqres.full
index 1228a25690429d639f5cf02e3689a1a4928642b7..fac688dfabca77d30ec9127cd729094e45cca582 100755 (executable)
@@ -40,6 +40,11 @@ fiemaplog=$SCRATCH_MNT/$seq.log
 
 _require_test_program "fiemap-tester"
 
+# FIEMAP test doesn't like finding unwritten blocks after it punches out
+# a partial rt extent.
+test "$FSTYP" = "xfs" && \
+       _require_file_block_size_equals_fs_block_size $fiemapfile
+
 seed=`date +%s`
 
 echo "using seed $seed" >> $fiemaplog