From: Anand Jain Date: Thu, 14 Mar 2024 06:37:40 +0000 (+0800) Subject: common/btrfs: introduce _require_btrfs_send_version X-Git-Tag: v2024.03.31~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=199d0a992536df3702a0c4843d2a449d54f399c2;p=xfstests-dev.git common/btrfs: introduce _require_btrfs_send_version Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and check if the Btrfs kernel supports the v3 stream. Reviewed-by: Boris Burkov Signed-off-by: Anand Jain --- diff --git a/common/btrfs b/common/btrfs index aa344706..ae13fb55 100644 --- a/common/btrfs +++ b/common/btrfs @@ -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. diff --git a/tests/btrfs/281 b/tests/btrfs/281 index 64075225..ddc7d9e8 100755 --- a/tests/btrfs/281 +++ b/tests/btrfs/281 @@ -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 diff --git a/tests/btrfs/284 b/tests/btrfs/284 index c6692668..0df494bc 100755 --- a/tests/btrfs/284 +++ b/tests/btrfs/284 @@ -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