]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: change how we test for supported raid configs
authorJosef Bacik <josef@toxicpanda.com>
Fri, 5 Apr 2024 19:56:13 +0000 (15:56 -0400)
committerZorro Lang <zlang@kernel.org>
Sun, 28 Apr 2024 11:08:22 +0000 (19:08 +0800)
In btrfs there's a few ways we limit the RAID profiles we'll use.  We
have the raid56 feature that can be compiled out, zoned devices don't
support certain raid configurations, and you can manually set
BTRFS_PROFILE_CONFIGS to limit what you're testing.

To handle all of these different scenarios in the same way, update
_btrfs_get_profile_configs() to check for RAID56 support and remove it
if it is not there, and then add _require_btrfs_raid_type and
_check_btrfs_raid_type to get all the settings and then check if the
requested raid type is available.

>From there I've updated all of the existing tests that use

_require_btrfs_fs_feature raid56

to use

_require_btrfs_raid_type <type>

where appropriate.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
common/btrfs
tests/btrfs/125
tests/btrfs/148
tests/btrfs/157
tests/btrfs/158

index a320b0e41d0d7a6ad40e8fdad065d1d5c35cae70..bc769cc4d3e017a0d07ea2076bc4865c674856dc 100644 (file)
@@ -109,11 +109,6 @@ _require_btrfs_fs_feature()
        modprobe btrfs > /dev/null 2>&1
        [ -e /sys/fs/btrfs/features/$feat ] || \
                _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}"
-       fi
 }
 
 _require_btrfs_fs_sysfs()
@@ -239,6 +234,8 @@ _btrfs_get_profile_configs()
                return
        fi
 
+       modprobe btrfs > /dev/null 2>&1
+
        local unsupported=()
        if [ "$1" == "replace" ]; then
                # We can't do replace with these profiles because they
@@ -258,6 +255,14 @@ _btrfs_get_profile_configs()
                )
        fi
 
+       if [ ! -e /sys/fs/btrfs/features/raid56 ]; then
+               # We don't have raid56 compiled in, remove them
+               unsupported+=(
+                       "raid5"
+                       "raid6"
+               )
+       fi
+
        if _scratch_btrfs_is_zoned; then
                # Zoned btrfs only supports SINGLE profile
                unsupported+=(
@@ -962,3 +967,18 @@ mkfs_clone()
 
        _mkfs_dev -fq --uuid $fsid --device-uuid $uuid $dev2
 }
+
+_check_btrfs_raid_type()
+{
+       _btrfs_get_profile_configs
+       if [[ ! "${_btrfs_profile_configs[@]}" =~ "$1" ]]; then
+               return 1
+       fi
+       return 0
+}
+
+_require_btrfs_raid_type()
+{
+       _check_btrfs_raid_type $1 || \
+               _notrun "$1 isn't supported by the profile config or scratch device"
+}
index 1b6e5d78b2f1f09475f0087e49d63a8ccbba7e34..d957c13911b48e1d63f2e451390849b02b39683a 100755 (executable)
@@ -41,7 +41,7 @@ _supported_fs btrfs
 _require_scratch_dev_pool 3
 _test_unmount
 _require_btrfs_forget_or_module_loadable
-_require_btrfs_fs_feature raid56
+_require_btrfs_raid_type raid5
 
 _scratch_dev_pool_get 3
 
index 65a262922569bcda7effb5e67cebd8602e7ac989..9bbcd8e92f88f029c61015e8943fd5d67fa66e72 100755 (executable)
@@ -17,7 +17,8 @@ _supported_fs btrfs
 _require_scratch
 _require_scratch_dev_pool 4
 _require_odirect
-_require_btrfs_fs_feature raid56
+_require_btrfs_raid_type raid5
+_require_btrfs_raid_type raid6
 
 _scratch_dev_pool_get 4
 
index 648db0d09d3df0258500306e1e8796773cc75427..aec844ffa8707a1bd198a814d2995561ece86ff8 100755 (executable)
@@ -34,7 +34,7 @@ _supported_fs btrfs
 _require_btrfs_no_nodatacow
 _require_scratch_dev_pool 4
 _require_btrfs_command inspect-internal dump-tree
-_require_btrfs_fs_feature raid56
+_require_btrfs_raid_type raid6
 
 get_physical()
 {
index 28599d096305ec6d828985ee650c5103b6e93e92..d7805afd6b4f90406313d948cb503a2e832fb907 100755 (executable)
@@ -26,7 +26,7 @@ _supported_fs btrfs
 _require_btrfs_no_nodatacow
 _require_scratch_dev_pool 4
 _require_btrfs_command inspect-internal dump-tree
-_require_btrfs_fs_feature raid56
+_require_btrfs_raid_type raid5
 
 get_physical()
 {