[PATCH] btrfs/287: make the test work when compression is enabled

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Filipe Manana <fdmanana@xxxxxxxx>

When running btrfs/287 with compression enabled (mount options), the test
fails because it expects to find 4M extents, however compression limits
the maximum size of extents to 128K, breaking the tests' expectations.

Example:

  $ MOUNT_OPTIONS="-o compress" ./check btrfs/287
  FSTYP         -- btrfs
  PLATFORM      -- Linux/x86_64 debian0 6.12.0-rc4-btrfs-next-177+ #1 SMP PREEMPT_DYNAMIC Thu Oct 24 17:14:37 WEST 2024
  MKFS_OPTIONS  -- /dev/sdc
  MOUNT_OPTIONS -- -o compress /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

  btrfs/287 2s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad)
      --- tests/btrfs/287.out	2024-10-19 18:21:30.451644840 +0100
      +++ /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad	2024-10-29 16:31:20.926612583 +0000
      @@ -25,22 +25,14 @@
       resolve first extent with ignore offset option:
       inode 257 offset 16777216 root 5
       inode 257 offset 8388608 root 5
      -inode 257 offset 2097152 root 5
       resolve first extent +1M offset:
      -inode 257 offset 17825792 root 5
      -inode 257 offset 9437184 root 5
      ...
      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/287.out /home/fdmanana/git/hub/xfstests/results//btrfs/287.out.bad'  to see the entire diff)

  HINT: You _MAY_ be missing kernel fix:
        0cad8f14d70c btrfs: fix backref walking not returning all inode refs

  Ran: btrfs/287
  Failures: btrfs/287
  Failed 1 of 1 tests

Fix this by creating the two 4M extents with fallocate, so that the test
works regardless of compression being enabled or not.

Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
---
 tests/btrfs/287     | 10 +++++-----
 tests/btrfs/287.out |  4 ----
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/tests/btrfs/287 b/tests/btrfs/287
index e88f4e0a..a51b31ed 100755
--- a/tests/btrfs/287
+++ b/tests/btrfs/287
@@ -7,13 +7,14 @@
 # Test btrfs' logical to inode ioctls (v1 and v2).
 #
 . ./common/preamble
-_begin_fstest auto quick snapshot clone punch logical_resolve
+_begin_fstest auto quick snapshot clone prealloc punch logical_resolve
 
 . ./common/filter.btrfs
 . ./common/reflink
 
 _require_btrfs_scratch_logical_resolve_v2
 _require_scratch_reflink
+_require_xfs_io_command "falloc"
 _require_xfs_io_command "fpunch"
 
 # This is a test case to test the logical to ino ioctl in general but it also
@@ -42,10 +43,9 @@ _scratch_mount
 #
 # 1) One 4M extent covering the file range [0, 4M)
 # 2) Another 4M extent covering the file range [4M, 8M)
-$XFS_IO_PROG -f -c "pwrite -S 0xab -b 4M 0 4M" \
-	     -c "fsync" \
-	     -c "pwrite -S 0xcd -b 4M 4M 8M" \
-	     -c "fsync" $SCRATCH_MNT/foo | _filter_xfs_io
+$XFS_IO_PROG -f -c "falloc 0 4M" \
+                -c "falloc 4M 4M" \
+                $SCRATCH_MNT/foo
 
 echo "resolve first extent:"
 first_extent_bytenr=$(_btrfs_get_file_extent_item_bytenr "$SCRATCH_MNT/foo" 0)
diff --git a/tests/btrfs/287.out b/tests/btrfs/287.out
index 4814594f..48541f7e 100644
--- a/tests/btrfs/287.out
+++ b/tests/btrfs/287.out
@@ -1,8 +1,4 @@
 QA output created by 287
-wrote 4194304/4194304 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 8388608/8388608 bytes at offset 4194304
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 resolve first extent:
 inode 257 offset 0 root 5
 resolve second extent:
-- 
2.45.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux