@@ -2680,7 +2680,7 @@ _require_deletable_scratch_dev_pool()
}
# We check for btrfs and (optionally) features of the btrfs command
-_require_btrfs()
+_require_btrfs_subcommand()
{
cmd=$1
_require_command "$BTRFS_UTIL_PROG" btrfs
@@ -2691,6 +2691,16 @@ _require_btrfs()
[ $? -eq 0 ] || _notrun "$BTRFS_UTIL_PROG too old (must support $cmd)"
}
+# We check if the kernel support given btrfs feature from its sysfs interface
+_require_btrfs_kernel_feature()
+{
+ feat=$1
+ # Use /dev/btrfs-control to ensure btrfs is loaded
+ touch /dev/btrfs-control
+ [[ ! -f /sys/fs/btrfs/features/$feat ]] && \
+ _notrun "kernel does not support $feat feature"
+}
+
# Check that fio is present, and it is able to execute given jobfile
_require_fio()
{
@@ -52,7 +52,7 @@ _supported_fs btrfs
_supported_os Linux
_require_scratch
_require_no_large_scratch_dev
-_require_btrfs inspect-internal
+_require_btrfs_subcommand inspect-internal
_require_command "/usr/sbin/filefrag" filefrag
rm -f $seqres.full
@@ -47,7 +47,7 @@ _supported_fs btrfs
_supported_os Linux
_require_test
_require_scratch
-_require_btrfs "property"
+_require_btrfs_subcommand "property"
_need_to_be_root
send_files_dir=$TEST_DIR/btrfs-test-$seq
@@ -50,7 +50,7 @@ _supported_fs btrfs
_supported_os Linux
_require_test
_require_scratch
-_require_btrfs "property"
+_require_btrfs_subcommand "property"
_need_to_be_root
rm -f $seqres.full
Btrfs has its sysfs interface showing what features current kernel/btrfs module support. Add _require_btrfs_kernel_feature() to check such interface. Also rename _require_btrfs() to _require_btrfs_subcommand() to avoid confusion. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- common/rc | 12 +++++++++++- tests/btrfs/004 | 2 +- tests/btrfs/048 | 2 +- tests/btrfs/059 | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-)