[PATCH 1/3] fstests: check btrfs profile configs before allowing raid56

Josef Bacik
2024-03-19T16:56:07Z

For some of our tests we have

_require_btrfs_fs_feature raid56

to make sure the raid56 support is loaded in the kernel. However this
isn't the only limiting factor, we can have only zoned devices which we
already check for, but we could also have BTRFS_PROFILE_CONFIGS set
without raid5 or raid6 as an option. Fix this by simply checking the
profile as appropriate and skip running the test if we're missing raid5
or raid6 in our profile settings.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
common/btrfs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/btrfs b/common/btrfs
index b0f7f095..d9b01a48 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -111,8 +111,12 @@ _require_btrfs_fs_feature()
_notrun "Feature $feat not supported by the available btrfs version"

if [ $feat = "raid56" ]; then
- # Zoned btrfs only supports SINGLE profile
- _require_non_zoned_device "${SCRATCH_DEV}"
+ # Make sure it's in our supported configs as well
+ _btrfs_get_profile_configs
+ if [[ ! "${_btrfs_profile_configs[@]}" =~ "raid5" ]] ||
+ [[ ! "${_btrfs_profile_configs[@]}" =~ "raid6" ]]; then
+ _notrun "raid56 excluded from profile configs"
+ fi
fi
}

--
2.43.0