]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
btrfs/246: skip the test if the tested btrfs doesn't support inline extents creation
authorQu Wenruo <wqu@suse.com>
Wed, 22 Mar 2023 05:52:11 +0000 (13:52 +0800)
committerZorro Lang <zlang@kernel.org>
Sat, 25 Mar 2023 04:38:21 +0000 (12:38 +0800)
[FALSE ALERT]
If test case btrfs/246 is executed with a 16K page sized system (like
some aarch64 SoCs) using 4K sector size (would be the new default), the
test case would fail with output mismatch:

  btrfs/246 1s ... - output mismatch (see ~/xfstests-dev/results//btrfs/246.out.bad)
      --- tests/btrfs/246.out 2022-11-24 19:53:53.158470844 +0800
      +++ ~/xfstests-dev/results//btrfs/246.out.bad 2023-03-22 13:27:34.975796048 +0800
      @@ -3,3 +3,5 @@
       0ca3bfdeda1ef5036bfa5dad078a9f15724e79cf296bd4388cf786bfaf4195d0  SCRATCH_MNT/foobar
       sha256sum after mount cycle
       0ca3bfdeda1ef5036bfa5dad078a9f15724e79cf296bd4388cf786bfaf4195d0  SCRATCH_MNT/foobar
      +no inline extent found
      +no compressed extent found
      ...
      (Run 'diff -u ~/xfstests-dev/tests/btrfs/246.out ~/xfstests-dev/results//btrfs/246.out.bad'  to see the entire diff)

[CAUSE]
For current btrfs subpage support, there are still some limitations:

- No compressed write if the range is not fully page aligned
- No inline extents creation
  Reading inline extents is still supported

Thus we won't create such inlined compressed extent at all.

[FIX]
Just skip the test case if we can not even create a regular inline
extent.

This is done by a new require helper,
_require_btrfs_inline_extent_creation(), which would detect if btrfs can
even create an uncompressed inlined extent.

Reported-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/btrfs
tests/btrfs/246

index 7c32360376c20d57d35a7f124e3426059ccd399f..344509ce300c145be4f3f5f3ab57178a64581abd 100644 (file)
@@ -499,6 +499,28 @@ _require_btrfs_support_sectorsize()
                _notrun "sectorsize $sectorsize is not supported"
 }
 
+_require_btrfs_inline_extents_creation()
+{
+       local ino
+
+       _require_xfs_io_command fiemap
+       _require_scratch
+
+       _scratch_mkfs &> /dev/null
+       _scratch_mount -o max_inline=2048,compress=none
+       _pwrite_byte 0x00 0 1024 $SCRATCH_MNT/inline &> /dev/null
+       sync
+       $XFS_IO_PROG -c "fiemap -v" $SCRATCH_MNT/inline | tail -n 1 > $tmp.fiemap
+       _scratch_unmount
+       # 0x200 means inlined, 0x100 means not block aligned, 0x1 means
+       # the last extent.
+       if ! grep -q "0x301" $tmp.fiemap; then
+               rm -f -- $tmp.fiemap
+               _notrun "No inline extent creation support, maybe subpage?"
+       fi
+       rm -f -- $tmp.fiemap
+}
+
 _btrfs_metadump()
 {
        local device="$1"
index 0dcc7c0d1a4334256d739bca98469a18f95d2160..2fe54f9590480c099ce74bd74a2f45619ae66234 100755 (executable)
@@ -23,6 +23,9 @@ _cleanup()
 _supported_fs btrfs
 _require_scratch
 
+# If it's subpage case, we don't support inline extents creation for now.
+_require_btrfs_inline_extents_creation
+
 _scratch_mkfs > /dev/null
 _scratch_mount -o compress,max_inline=2048