]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/btrfs: introduce _require_btrfs_send_version
authorAnand Jain <anand.jain@oracle.com>
Thu, 14 Mar 2024 06:37:40 +0000 (14:37 +0800)
committerAnand Jain <anand.jain@oracle.com>
Wed, 20 Mar 2024 14:32:52 +0000 (22:32 +0800)
Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and
check if the Btrfs kernel supports the v3 stream.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
common/btrfs
tests/btrfs/281
tests/btrfs/284

index aa344706cd5f81a06a2208fb5b4e7c2a18e3080d..ae13fb55cbc6326f23cdef2c40ed1f5103e408b2 100644 (file)
@@ -662,18 +662,20 @@ _require_btrfs_corrupt_block()
        _require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block
 }
 
-_require_btrfs_send_v2()
+_require_btrfs_send_version()
 {
+       local version=$1
+
        # Check first if btrfs-progs supports the v2 stream.
        _require_btrfs_command send --compressed-data
 
        # Now check the kernel support. If send_stream_version does not exists,
        # then it's a kernel that only supports v1.
        [ -f /sys/fs/btrfs/features/send_stream_version ] || \
-               _notrun "kernel does not support send stream v2"
+               _notrun "kernel does not support send stream $version"
 
-       [ $(cat /sys/fs/btrfs/features/send_stream_version) -gt 1 ] || \
-               _notrun "kernel does not support send stream v2"
+       [ $(cat /sys/fs/btrfs/features/send_stream_version) -ge $version ] || \
+               _notrun "kernel does not support send stream $version"
 }
 
 # Get the bytenr associated to a file extent item at a given file offset.
index 6407522567b88d5dbf945fb3093dad470de7091c..ddc7d9e8b06d955b9e43f3d766f4febb634ba8e7 100755 (executable)
@@ -22,7 +22,7 @@ _begin_fstest auto quick send compress clone fiemap
 _supported_fs btrfs
 _require_test
 _require_scratch_reflink
-_require_btrfs_send_v2
+_require_btrfs_send_version 2
 _require_xfs_io_command "fiemap"
 _require_fssum
 _require_btrfs_no_nodatacow
index c6692668f7fcdf2234ca84c5f0f082bc2854f04b..0df494bc8ab4729f567859c0bea2841198705ee5 100755 (executable)
@@ -12,7 +12,7 @@ _begin_fstest auto quick send compress snapshot
 
 # Modify as appropriate.
 _supported_fs btrfs
-_require_btrfs_send_v2
+_require_btrfs_send_version 2
 _require_test
 # The size needed is variable as it depends on the specific randomized
 # operations from fsstress and on the value of $LOAD_FACTOR. But require at