]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
btrfs/287: make the test work when compression is enabled
authorFilipe Manana <fdmanana@suse.com>
Tue, 29 Oct 2024 17:21:28 +0000 (17:21 +0000)
committerZorro Lang <zlang@kernel.org>
Wed, 30 Oct 2024 08:21:26 +0000 (16:21 +0800)
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@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/287
tests/btrfs/287.out

index e88f4e0a8bedc75117d6717d218c4bfe36f36117..a51b31ed822aa62479050430158175dfc264a91d 100755 (executable)
@@ -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)
index 4814594fc22467ad4f3fb032d78095989a55b2ff..48541f7e347b38a7482288778765ed362c80afb6 100644 (file)
@@ -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: