diff mbox series

[40/43] xfs: add a max_open_zones mount option

Message ID 20241211085636.1380516-41-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/43] xfs: constify feature checks | expand

Commit Message

Christoph Hellwig Dec. 11, 2024, 8:55 a.m. UTC
Allow limiting the number of open zones used below that exported by the
device.  This is required to tune the number of write streams when zoned
RT devices are used on conventional devices, and can be useful on zoned
devices that support a very large number of open zones.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_super.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong Dec. 13, 2024, 10:57 p.m. UTC | #1
On Wed, Dec 11, 2024 at 09:55:05AM +0100, Christoph Hellwig wrote:
> Allow limiting the number of open zones used below that exported by the
> device.  This is required to tune the number of write streams when zoned
> RT devices are used on conventional devices, and can be useful on zoned
> devices that support a very large number of open zones.

Can this be changed during a remount operation?  Do we have to
revalidate the value?

--D

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_super.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 690bb068a23a..e24f6a608b91 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -110,7 +110,7 @@ enum {
>  	Opt_filestreams, Opt_quota, Opt_noquota, Opt_usrquota, Opt_grpquota,
>  	Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota,
>  	Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce,
> -	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum,
> +	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, Opt_max_open_zones,
>  };
>  
>  static const struct fs_parameter_spec xfs_fs_parameters[] = {
> @@ -155,6 +155,7 @@ static const struct fs_parameter_spec xfs_fs_parameters[] = {
>  	fsparam_flag("nodiscard",	Opt_nodiscard),
>  	fsparam_flag("dax",		Opt_dax),
>  	fsparam_enum("dax",		Opt_dax_enum, dax_param_enums),
> +	fsparam_u32("max_open_zones",	Opt_max_open_zones),
>  	{}
>  };
>  
> @@ -234,6 +235,9 @@ xfs_fs_show_options(
>  	if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
>  		seq_puts(m, ",noquota");
>  
> +	if (mp->m_max_open_zones)
> +		seq_printf(m, ",max_open_zones=%u", mp->m_max_open_zones);
> +
>  	return 0;
>  }
>  
> @@ -1456,6 +1460,9 @@ xfs_fs_parse_param(
>  		xfs_fs_warn_deprecated(fc, param, XFS_FEAT_NOATTR2, true);
>  		parsing_mp->m_features |= XFS_FEAT_NOATTR2;
>  		return 0;
> +	case Opt_max_open_zones:
> +		parsing_mp->m_max_open_zones = result.uint_32;
> +		return 0;
>  	default:
>  		xfs_warn(parsing_mp, "unknown mount option [%s].", param->key);
>  		return -EINVAL;
> -- 
> 2.45.2
> 
>
Christoph Hellwig Dec. 15, 2024, 6:16 a.m. UTC | #2
On Fri, Dec 13, 2024 at 02:57:11PM -0800, Darrick J. Wong wrote:
> On Wed, Dec 11, 2024 at 09:55:05AM +0100, Christoph Hellwig wrote:
> > Allow limiting the number of open zones used below that exported by the
> > device.  This is required to tune the number of write streams when zoned
> > RT devices are used on conventional devices, and can be useful on zoned
> > devices that support a very large number of open zones.
> 
> Can this be changed during a remount operation?  Do we have to
> revalidate the value?

Right no it can't be changed during remount as there is no code added for
it in xfs_fs_reconfigure.  If a strong use case to change it shows up
we could support it, but it's going to require some nasty code especially
for reducing the limit, so I'd rather not do it unless I have to.
Darrick J. Wong Dec. 17, 2024, 5:12 p.m. UTC | #3
On Sun, Dec 15, 2024 at 07:16:44AM +0100, Christoph Hellwig wrote:
> On Fri, Dec 13, 2024 at 02:57:11PM -0800, Darrick J. Wong wrote:
> > On Wed, Dec 11, 2024 at 09:55:05AM +0100, Christoph Hellwig wrote:
> > > Allow limiting the number of open zones used below that exported by the
> > > device.  This is required to tune the number of write streams when zoned
> > > RT devices are used on conventional devices, and can be useful on zoned
> > > devices that support a very large number of open zones.
> > 
> > Can this be changed during a remount operation?  Do we have to
> > revalidate the value?
> 
> Right no it can't be changed during remount as there is no code added for
> it in xfs_fs_reconfigure.  If a strong use case to change it shows up
> we could support it, but it's going to require some nasty code especially
> for reducing the limit, so I'd rather not do it unless I have to.

Nah let's wait until someone actually gives us a use case.

--D
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 690bb068a23a..e24f6a608b91 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -110,7 +110,7 @@  enum {
 	Opt_filestreams, Opt_quota, Opt_noquota, Opt_usrquota, Opt_grpquota,
 	Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota,
 	Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce,
-	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum,
+	Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, Opt_max_open_zones,
 };
 
 static const struct fs_parameter_spec xfs_fs_parameters[] = {
@@ -155,6 +155,7 @@  static const struct fs_parameter_spec xfs_fs_parameters[] = {
 	fsparam_flag("nodiscard",	Opt_nodiscard),
 	fsparam_flag("dax",		Opt_dax),
 	fsparam_enum("dax",		Opt_dax_enum, dax_param_enums),
+	fsparam_u32("max_open_zones",	Opt_max_open_zones),
 	{}
 };
 
@@ -234,6 +235,9 @@  xfs_fs_show_options(
 	if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
 		seq_puts(m, ",noquota");
 
+	if (mp->m_max_open_zones)
+		seq_printf(m, ",max_open_zones=%u", mp->m_max_open_zones);
+
 	return 0;
 }
 
@@ -1456,6 +1460,9 @@  xfs_fs_parse_param(
 		xfs_fs_warn_deprecated(fc, param, XFS_FEAT_NOATTR2, true);
 		parsing_mp->m_features |= XFS_FEAT_NOATTR2;
 		return 0;
+	case Opt_max_open_zones:
+		parsing_mp->m_max_open_zones = result.uint_32;
+		return 0;
 	default:
 		xfs_warn(parsing_mp, "unknown mount option [%s].", param->key);
 		return -EINVAL;