diff mbox series

common/rc: avoid mixed mode for zoned btrfs

Message ID 20220222041908.3213724-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series common/rc: avoid mixed mode for zoned btrfs | expand

Commit Message

Shinichiro Kawasaki Feb. 22, 2022, 4:19 a.m. UTC
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>
---
This is the left work of the series posted before [1]. Reposted as a single
patch.

Change from the previous post:
* Keep change minimum btrfs device size as 256MiB.

[1] https://lore.kernel.org/fstests/20220221110254.y2yb7xdlf22ahh7k@shindev/

 common/rc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Naohiro Aota March 7, 2022, 1:43 a.m. UTC | #1
Looks good.

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>

On Tue, Feb 22, 2022 at 01:19:08PM +0900, Shin'ichiro Kawasaki wrote:
> 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>
> ---
> This is the left work of the series posted before [1]. Reposted as a single
> patch.
> 
> Change from the previous post:
> * Keep change minimum btrfs device size as 256MiB.
> 
> [1] https://lore.kernel.org/fstests/20220221110254.y2yb7xdlf22ahh7k@shindev/
> 
>  common/rc | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index e2d3d72a..d326572f 100644
> --- 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)
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index e2d3d72a..d326572f 100644
--- 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)