diff mbox series

[11/17] xfs: handle zoned file systems in _scratch_xfs_force_no_metadir

Message ID 20250312064541.664334-12-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:45 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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Darrick J. Wong March 12, 2025, 8:23 p.m. UTC | #1
On Wed, Mar 12, 2025 at 07:45:03AM +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 | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/common/xfs b/common/xfs
> index 86953b7310d9..a18b721eb5cf 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -2054,6 +2054,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
> @@ -2074,6 +2080,11 @@ _scratch_xfs_force_no_metadir()
>  	if grep -q 'metadir=' $MKFS_XFS_PROG; then
>  		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
>  	fi
> +
> +	# zoned requires metadir
> +	if grep -q 'zoned=' $MKFS_XFS_PROG; then
> +		MKFS_OPTIONS="-m zoned=0 $MKFS_OPTIONS"

I think this cause mkfs to fail due to the respecification of -mzoned
if MKFS_OPTIONS originally had -mzoned= in it?

--D

> +	fi
>  }
>  
>  # do not run on zoned file systems
> -- 
> 2.45.2
> 
>
Christoph Hellwig March 13, 2025, 7:28 a.m. UTC | #2
On Wed, Mar 12, 2025 at 01:23:14PM -0700, Darrick J. Wong wrote:
> >  	for opt in uquota gquota pquota; do
> > @@ -2074,6 +2080,11 @@ _scratch_xfs_force_no_metadir()
> >  	if grep -q 'metadir=' $MKFS_XFS_PROG; then
> >  		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
> >  	fi
> > +
> > +	# zoned requires metadir
> > +	if grep -q 'zoned=' $MKFS_XFS_PROG; then
> > +		MKFS_OPTIONS="-m zoned=0 $MKFS_OPTIONS"
> 
> I think this cause mkfs to fail due to the respecification of -mzoned
> if MKFS_OPTIONS originally had -mzoned= in it?

Hmm, don't we allow respecification to override earlier settings?
Let me double check the _scratch_xfs_force_no_metadir tests on
zoned on conventional runs.
Darrick J. Wong March 13, 2025, 5:18 p.m. UTC | #3
On Thu, Mar 13, 2025 at 08:28:09AM +0100, Christoph Hellwig wrote:
> On Wed, Mar 12, 2025 at 01:23:14PM -0700, Darrick J. Wong wrote:
> > >  	for opt in uquota gquota pquota; do
> > > @@ -2074,6 +2080,11 @@ _scratch_xfs_force_no_metadir()
> > >  	if grep -q 'metadir=' $MKFS_XFS_PROG; then
> > >  		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
> > >  	fi
> > > +
> > > +	# zoned requires metadir
> > > +	if grep -q 'zoned=' $MKFS_XFS_PROG; then
> > > +		MKFS_OPTIONS="-m zoned=0 $MKFS_OPTIONS"
> > 
> > I think this cause mkfs to fail due to the respecification of -mzoned
> > if MKFS_OPTIONS originally had -mzoned= in it?
> 
> Hmm, don't we allow respecification to override earlier settings?

Nope:

$ mkfs.xfs -f -m rmapbt=0 -m rmapbt=1 /tmp/a
-m rmapbt option respecified
<snip>

You can't even override the options specified in a config file:

$ mkfs.xfs -f -c options=/usr/share/xfsprogs/mkfs/lts_5.4.conf -m rmapbt=1 /tmp/a
-m rmapbt option respecified

> Let me double check the _scratch_xfs_force_no_metadir tests on
> zoned on conventional runs.

--D
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index 86953b7310d9..a18b721eb5cf 100644
--- a/common/xfs
+++ b/common/xfs
@@ -2054,6 +2054,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
@@ -2074,6 +2080,11 @@  _scratch_xfs_force_no_metadir()
 	if grep -q 'metadir=' $MKFS_XFS_PROG; then
 		MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS"
 	fi
+
+	# zoned requires metadir
+	if grep -q 'zoned=' $MKFS_XFS_PROG; then
+		MKFS_OPTIONS="-m zoned=0 $MKFS_OPTIONS"
+	fi
 }
 
 # do not run on zoned file systems