]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: avoid mixed mode for zoned btrfs
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 22 Feb 2022 04:19:08 +0000 (13:19 +0900)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Mar 2022 16:38:41 +0000 (00:38 +0800)
When the helper function _scratch_mkfs_sized is called with small
filesystem size and FSTYP=btrfs, it calls mkfs.btrfs with --mixed option
to enable mixed mode. However, mkfs.btrfs with --mixed option fails for
zoned block devices since btrfs does not support mixed mode together
with zoned mode. To avoid this failure, do not set --mixed option when
the scratch device is a zoned block device.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index e2d3d72a00f6535ee4a5cb9ba2978e6db6b55e2b..d326572f08f407f33af27d032c45c8a300523ee6 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1078,10 +1078,10 @@ _scratch_mkfs_sized()
                ;;
        btrfs)
                local mixed_opt=
-               # minimum size that's needed without the mixed option.
-               # Ref: btrfs-prog: btrfs_min_dev_size()
-               # Non mixed mode is also the default option.
-               (( fssize < $((256 * 1024 *1024)) )) && mixed_opt='--mixed'
+               # Mixed option is required when the filesystem size is small and
+               # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size()
+               (( fssize < $((256 * 1024 * 1024)) )) &&
+                       ! _scratch_btrfs_is_zoned && mixed_opt='--mixed'
                $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
                ;;
        jfs)