diff mbox series

[07/17] common: support internal RT devices in scratch_mkfs_sized

Message ID 20250312064541.664334-8-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/17] xfs/177: force a small file system size | expand

Commit Message

Christoph Hellwig March 12, 2025, 6:44 a.m. UTC
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/rc | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Darrick J. Wong March 12, 2025, 8:15 p.m. UTC | #1
On Wed, Mar 12, 2025 at 07:44:59AM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  common/rc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 00a315db0fe7..5e56d90e5931 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1268,6 +1268,7 @@ _try_scratch_mkfs_sized()
>  	case $FSTYP in
>  	xfs)
>  		local rt_ops
> +		local zone_type=`_zone_type $SCRATCH_DEV`
>  
>  		if [ -b "$SCRATCH_RTDEV" ]; then
>  			local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
> @@ -1275,6 +1276,12 @@ _try_scratch_mkfs_sized()
>  				_notrun "Scratch rt device too small"
>  			fi
>  			rt_ops="-r size=$fssize"
> +		elif [ "${zone_type}" != "none" ] ||
> +		     [[ $MKFS_OPTIONS =~ "zoned=1" ]]; then
> +			# Maybe also add back the size check, but it'll require
> +			# somewhat complicated arithmetics for the size of the
> +			# conventional zones
> +			rt_ops="-r size=$fssize"

Hmm, what happens if you pass -dsize=X and -rzoned=1,size=X?

Oh, you get a data section of size X followed by an internal zoned
section also of size X.

Might want to mention that in the commit message...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  		fi
>  
>  		# don't override MKFS_OPTIONS that set a block size.
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 00a315db0fe7..5e56d90e5931 100644
--- a/common/rc
+++ b/common/rc
@@ -1268,6 +1268,7 @@  _try_scratch_mkfs_sized()
 	case $FSTYP in
 	xfs)
 		local rt_ops
+		local zone_type=`_zone_type $SCRATCH_DEV`
 
 		if [ -b "$SCRATCH_RTDEV" ]; then
 			local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
@@ -1275,6 +1276,12 @@  _try_scratch_mkfs_sized()
 				_notrun "Scratch rt device too small"
 			fi
 			rt_ops="-r size=$fssize"
+		elif [ "${zone_type}" != "none" ] ||
+		     [[ $MKFS_OPTIONS =~ "zoned=1" ]]; then
+			# Maybe also add back the size check, but it'll require
+			# somewhat complicated arithmetics for the size of the
+			# conventional zones
+			rt_ops="-r size=$fssize"
 		fi
 
 		# don't override MKFS_OPTIONS that set a block size.