diff mbox series

[07/13] xfs: handle zoned file systems in _scratch_xfs_force_no_metadir

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

Commit Message

Christoph Hellwig March 21, 2025, 7:21 a.m. UTC
Zoned file systems required the metadir feature.  If the tests are run
on a conventional block device as the RT device, we can simply remove
the zoned flag an run the test, but if the file systems sits on a zoned
block device there is no way to run a test that wants a non-metadir
file system.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/xfs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Darrick J. Wong March 21, 2025, 3:18 p.m. UTC | #1
On Fri, Mar 21, 2025 at 08:21:36AM +0100, Christoph Hellwig wrote:
> Zoned file systems required the metadir feature.  If the tests are run
> on a conventional block device as the RT device, we can simply remove
> the zoned flag an run the test, but if the file systems sits on a zoned
> block device there is no way to run a test that wants a non-metadir
> file system.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  common/xfs | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 3663e4cf03bd..c1b4c5577b2b 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -2049,6 +2049,12 @@ _scratch_xfs_find_metafile()
>  # Force metadata directories off.
>  _scratch_xfs_force_no_metadir()
>  {
> +	_require_non_zoned_device $SCRATCH_DEV
> +	# metadir is required for when the rt device is on a zoned device
> +	if [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ]; then
> +		_require_non_zoned_device $SCRATCH_RTDEV
> +	fi
> +
>  	# Remove any mkfs-time quota options because those are only supported
>  	# with metadir=1
>  	for opt in uquota gquota pquota; do
> @@ -2068,6 +2074,12 @@ _scratch_xfs_force_no_metadir()
>  	# that option.
>  	if grep -q 'metadir=' $MKFS_XFS_PROG; then
>  		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
> +	fi	

Dumb nit: ^^^^^^ extra space here

> +
> +	# Replace any explicit zonedr option with zoned=0
> +	if echo "$MKFS_OPTIONS" | grep -q 'zoned='; then
> +		MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/zoned=[0-9]*/zoned=0/g' -e 's/zoned\([, ]\)/zoned=0\1/g')"

With that fixed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> +		return
>  	fi
>  }
>  
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index 3663e4cf03bd..c1b4c5577b2b 100644
--- a/common/xfs
+++ b/common/xfs
@@ -2049,6 +2049,12 @@  _scratch_xfs_find_metafile()
 # Force metadata directories off.
 _scratch_xfs_force_no_metadir()
 {
+	_require_non_zoned_device $SCRATCH_DEV
+	# metadir is required for when the rt device is on a zoned device
+	if [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ]; then
+		_require_non_zoned_device $SCRATCH_RTDEV
+	fi
+
 	# Remove any mkfs-time quota options because those are only supported
 	# with metadir=1
 	for opt in uquota gquota pquota; do
@@ -2068,6 +2074,12 @@  _scratch_xfs_force_no_metadir()
 	# that option.
 	if grep -q 'metadir=' $MKFS_XFS_PROG; then
 		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
+	fi	
+
+	# Replace any explicit zonedr option with zoned=0
+	if echo "$MKFS_OPTIONS" | grep -q 'zoned='; then
+		MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/zoned=[0-9]*/zoned=0/g' -e 's/zoned\([, ]\)/zoned=0\1/g')"
+		return
 	fi
 }