With this helper, btrfs test cases can now check if a particular feature is implemented in the kernel. Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx> --- common/btrfs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/btrfs b/common/btrfs index c3bffd2ae3f7..fbc26181f7bc 100644 --- a/common/btrfs +++ b/common/btrfs @@ -753,3 +753,15 @@ _require_scratch_enable_simple_quota() _notrun "simple quotas not available" _scratch_unmount } + +_has_btrfs_sysfs_feature_attr() +{ + local feature_attr=$1 + + [ -z $feature_attr ] && \ + _fail "Missing feature name argument for _has_btrfs_sysfs_attr" + + modprobe btrfs &> /dev/null + + test -e /sys/fs/btrfs/features/$feature_attr +} -- 2.31.1