]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
btrfs: add checks for zoned block device
authorNaohiro Aota <naohiro.aota@wdc.com>
Mon, 16 Aug 2021 11:35:09 +0000 (20:35 +0900)
committerEryu Guan <guaneryu@gmail.com>
Sun, 22 Aug 2021 10:27:14 +0000 (18:27 +0800)
Modify btrfs tests to require non-zoned block device or limit some
part of tests not to be run on zone block devices.

Modified tests by the reasons:

* Mixed BG
  - btrfs/011
* Non-single profile
  - btrfs/003
  - btrfs/011
  - btrfs/023
  - btrfs/124
  - btrfs/195
  - btrfs/197
  - btrfs/198
  - and these are restricted indirectly by "_require_btrfs_fs_feature raid56"
    - btrfs/125
    - btrfs/148
    - btrfs/157
    - btrfs/158
* Convert from ext4
  - btrfs/012
  - btrfs/136
* nodatacow
  - btrfs/236
* inode cache
  - btrfs/049
* space cache (v1)
  - btrfs/131
* write outside of FS code
  - btrfs/116
  - btrfs/140
  - btrfs/215
* verbose output
  - btrfs/194

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
17 files changed:
common/btrfs
tests/btrfs/003
tests/btrfs/011
tests/btrfs/012
tests/btrfs/023
tests/btrfs/049
tests/btrfs/116
tests/btrfs/124
tests/btrfs/131
tests/btrfs/136
tests/btrfs/140
tests/btrfs/194
tests/btrfs/195
tests/btrfs/197
tests/btrfs/198
tests/btrfs/215
tests/btrfs/236

index ebe6ce269a6b52678b67eadda2774beb0fbb30d6..ac880bddf524e040b5b042be93c769cdfc943d1c 100644 (file)
@@ -96,6 +96,11 @@ _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()
@@ -222,6 +227,21 @@ _btrfs_get_profile_configs()
                else
                        local unsupported=()
                fi
+
+               if _scratch_btrfs_is_zoned; then
+                       # Zoned btrfs only supports SINGLE profile
+                       unsupported+=(
+                               "dup"
+                               "raid0"
+                               "raid1"
+                               "raid1c3"
+                               "raid1c4"
+                               "raid10"
+                               "raid5"
+                               "raid6"
+                       )
+               fi
+
                for unsupp in "${unsupported[@]}"; do
                        if [ "${profiles[0]}" == "$unsupp" -o "${profiles[1]}" == "$unsupp" ]; then
                             if [ -z "$BTRFS_PROFILE_CONFIGS" ]; then
@@ -419,3 +439,9 @@ _btrfs_rescan_devices()
 {
        $BTRFS_UTIL_PROG device scan &> /dev/null
 }
+
+_scratch_btrfs_is_zoned()
+{
+       [ `_zone_type ${SCRATCH_DEV}` != "none" ] && return 0
+       return 1
+}
index d241ec6e9fddf78aadb60645962adb0f6fb12008..0aa4c99176b5661dfb4ee2459f7bee771403a76e 100755 (executable)
@@ -173,12 +173,20 @@ _test_remove()
        _scratch_unmount
 }
 
-_test_raid0
-_test_raid1
-_test_raid10
+# Zoned btrfs only supports SINGLE profile
+if ! _scratch_btrfs_is_zoned; then
+       _test_raid0
+       _test_raid1
+       _test_raid10
+fi
+
 _test_single
 _test_add
-_test_replace
+# _test_replace() uses raid1, but zoned btrfs only supports SINGLE
+# profile
+if ! _scratch_btrfs_is_zoned; then
+       _test_replace
+fi
 _test_remove
 
 echo "Silence is golden"
index f5d865ab3d21729823a375118e408e200b586ad7..b4673341c24ba6e00a96e4f844b829efa6a50bd8 100755 (executable)
@@ -226,15 +226,18 @@ btrfs_replace_test()
 }
 
 workout "-m single -d single" 1 no 64
-workout "-m single -d single -M" 1 no 64
-workout "-m dup -d single" 1 no 64
-workout "-m dup -d single" 1 cancel 1024
-workout "-m dup -d dup -M" 1 no 64
-workout "-m raid0 -d raid0" 2 no 64
-workout "-m raid1 -d raid1" 2 no 2048
-workout "-m raid5 -d raid5" 2 no 64
-workout "-m raid6 -d raid6" 3 no 64
-workout "-m raid10 -d raid10" 4 no 64
+# Mixed BG & RAID/DUP profiles are not supported on zoned btrfs
+if ! _scratch_btrfs_is_zoned; then
+       workout "-m dup -d single" 1 no 64
+       workout "-m dup -d single" 1 cancel 1024
+       workout "-m raid0 -d raid0" 2 no 64
+       workout "-m raid1 -d raid1" 2 no 2048
+       workout "-m raid10 -d raid10" 4 no 64
+       workout "-m single -d single -M" 1 no 64
+       workout "-m dup -d dup -M" 1 no 64
+       workout "-m raid5 -d raid5" 2 no 64
+       workout "-m raid6 -d raid6" 3 no 64
+fi
 
 echo "*** done"
 status=0
index 46341e984821437be516b502d9bc6d69d9dafb31..3040a655095c8f42b77aa1173f923d6cbf4f9250 100755 (executable)
@@ -28,6 +28,8 @@ _require_scratch_nocheck
 _require_command "$BTRFS_CONVERT_PROG" btrfs-convert
 _require_command "$MKFS_EXT4_PROG" mkfs.ext4
 _require_command "$E2FSCK_PROG" e2fsck
+# ext4 does not support zoned block device
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 _require_fs_space $SCRATCH_MNT $(du -s /lib/modules/`uname -r` | ${AWK_PROG} '{print $1}')
 
index f6c05b121099e4ab40b3102556963a8341d7032d..9facf3e2092c74da7032668cc3a6c11e7d3ebc35 100755 (executable)
@@ -17,6 +17,8 @@ _begin_fstest auto
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch_dev_pool 4
+# Zoned btrfs only supports SINGLE profile
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 create_group_profile()
 {
index ad4ef122f3c970437cd9ccdbdc72735cf6b1029a..87c205ca9650537709893621466b000beec2ab23 100755 (executable)
@@ -27,6 +27,8 @@ _cleanup()
 _supported_fs btrfs
 _require_scratch
 _require_dm_target flakey
+# Zoned btrfs does not support inode cache
+_require_non_zoned_device "$SCRATCH_DEV"
 
 _scratch_mkfs >> $seqres.full 2>&1
 
index 14182e9c0f49f7fdc9bdcf80e32f5880b3dc043c..2449e6e3a64df3c4b7af4f79b08451fdf5bffd58 100755 (executable)
@@ -18,6 +18,8 @@ _begin_fstest auto quick metadata
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch
+# Writing non-contiguous data directly to the device
+_require_non_zoned_device $SCRATCH_DEV
 
 _scratch_mkfs >>$seqres.full 2>&1
 
index 3036cbf4a72cc836babb4db604cf39b605bdde4a..5c05ffae1b8f842aa745d8b8c0268de0acbae2a2 100755 (executable)
@@ -49,6 +49,10 @@ _scratch_dev_pool_get 2
 dev1=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
 dev2=`echo $SCRATCH_DEV_POOL | awk '{print $2}'`
 
+# RAID1 is not supported on zoned btrfs
+_require_non_zoned_device "$dev1"
+_require_non_zoned_device "$dev2"
+
 dev1_sz=`blockdev --getsize64 $dev1`
 dev2_sz=`blockdev --getsize64 $dev2`
 # get min of both
index 81e5d9bc90c785c8e10c582466461705aee3307a..1e072b285ecfeaaafa4ad8abe10d052a9d8f9ac3 100755 (executable)
@@ -18,6 +18,8 @@ _supported_fs btrfs
 _require_scratch
 _require_btrfs_command inspect-internal dump-super
 _require_btrfs_fs_feature free_space_tree
+# Zoned btrfs does not support space_cache(v1)
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 mkfs_v1()
 {
index 896be18d84f889379f70b97016b7bcb385b518bf..b9ab8270f039108907d0c9a8a631139651b3af26 100755 (executable)
@@ -22,6 +22,8 @@ _begin_fstest auto convert
 # Modify as appropriate.
 _supported_fs btrfs
 _require_scratch_nocheck
+# ext4 does not support zoned block device
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 _require_command "$BTRFS_CONVERT_PROG" btrfs-convert
 _require_command "$MKFS_EXT4_PROG" mkfs.ext4
index f3379cae75decf0fe22a7f9eb6fa990fdb5672bf..5a5f828ce0debdcebfce53c3bccd4580ecc3aa8c 100755 (executable)
@@ -26,6 +26,8 @@ _require_scratch_dev_pool 2
 _require_btrfs_command inspect-internal dump-tree
 _require_command "$FILEFRAG_PROG" filefrag
 _require_odirect
+# Overwriting data is forbidden on a zoned block device
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 get_physical()
 {
index 9a67e572ef7419aef14fb78a0a79a99729c1d7ad..a994a429628bd8a368845dcf2568da32c9193db3 100755 (executable)
@@ -59,7 +59,7 @@ for (( i = 0; i < 64; i++ )); do
        $BTRFS_UTIL_PROG device del $device_1 $SCRATCH_MNT
        $BTRFS_UTIL_PROG device add -f $device_1 $SCRATCH_MNT
        $BTRFS_UTIL_PROG device del $device_2 $SCRATCH_MNT
-done
+done | grep -v 'Resetting device zone'
 _scratch_dev_pool_put
 
 echo "Silence is golden"
index 59b97970449100cf380e60e24fb39b88985c8822..747345973244711443af343966f310792897ef83 100755 (executable)
@@ -18,6 +18,8 @@ _begin_fstest auto volume balance
 # Modify as appropriate.
 _supported_fs btrfs
 _require_scratch_dev_pool 4
+# Zoned btrfs only supports SINGLE profile
+_require_non_zoned_device "${SCRATCH_DEV}"
 
 declare -a TEST_VECTORS=(
 # $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
index f5baf5b6066beec0e377bbf63023f86ec69384ab..597bc36f0fd7fdf080252b2e7583a53b0208a202 100755 (executable)
@@ -30,6 +30,8 @@ _supported_fs btrfs
 _require_test
 _require_scratch
 _require_scratch_dev_pool 5
+# Zoned btrfs only supports SINGLE profile
+_require_non_zoned_device ${SCRATCH_DEV}
 
 workout()
 {
index b3e175a25bf963dc95c2a1e4cfb1ef34af0e3538..035c63fdb5ecaefd32bdad05caccb42d6cce37cf 100755 (executable)
@@ -20,6 +20,8 @@ _supported_fs btrfs
 _require_command "$WIPEFS_PROG" wipefs
 _require_scratch
 _require_scratch_dev_pool 4
+# Zoned btrfs only supports SINGLE profile
+_require_non_zoned_device ${SCRATCH_DEV}
 
 workout()
 {
index b45bd520b8e6d59ef190b2503201ae757da93aea..fa622568adfd977ac19a64004a044c5f04346f7d 100755 (executable)
@@ -24,6 +24,8 @@ get_physical()
 
 # Modify as appropriate.
 _supported_fs btrfs
+# Overwriting data is forbidden on a zoned block device
+_require_non_zoned_device $SCRATCH_DEV
 
 _scratch_mkfs > /dev/null
 # disable freespace inode to ensure file is the first thing in the data
index a16a1ce62d3af088026cb21e5aec055d2004bb56..8481d8f380d2ce8a066748b8757a56a4bb81c475 100755 (executable)
@@ -173,21 +173,28 @@ for ((i = 1; i <= 3; i++)); do
        test_fsync "link_cow_$i" "link"
 done
 
-# Now lets test with nodatacow.
 _unmount_flakey
-MOUNT_OPTIONS="-o nodatacow"
-_mount_flakey
 
-echo "Testing fsync after rename with NOCOW writes"
-for ((i = 1; i <= 3; i++)); do
-       test_fsync "rename_nocow_$i" "rename"
-done
-echo "Testing fsync after link with NOCOW writes"
-for ((i = 1; i <= 3; i++)); do
-       test_fsync "link_nocow_$i" "link"
-done
-
-_unmount_flakey
+# Now lets test with nodatacow.
+if ! _scratch_btrfs_is_zoned; then
+       MOUNT_OPTIONS="-o nodatacow"
+       _mount_flakey
+
+       echo "Testing fsync after rename with NOCOW writes"
+       for ((i = 1; i <= 3; i++)); do
+               test_fsync "rename_nocow_$i" "rename"
+       done
+       echo "Testing fsync after link with NOCOW writes"
+       for ((i = 1; i <= 3; i++)); do
+               test_fsync "link_nocow_$i" "link"
+       done
+
+       _unmount_flakey
+else
+       # Fake result. Zoned btrfs does not support NOCOW
+       echo "Testing fsync after rename with NOCOW writes"
+       echo "Testing fsync after link with NOCOW writes"
+fi
 
 status=0
 exit