]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: add a max_open_zones mount option
authorChristoph Hellwig <hch@lst.de>
Sun, 17 Nov 2024 07:05:16 +0000 (08:05 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Mar 2025 15:17:09 +0000 (08:17 -0700)
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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/xfs/xfs_super.c

index 4ea7150692dd0bbbfe9d9e4b3a847df93aeb92f5..aac50bdd629ca8959c93e757cbb1d7d4bb8410d7 100644 (file)
@@ -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;
 }
 
@@ -1081,6 +1085,14 @@ xfs_finish_flags(
                return -EINVAL;
        }
 
+       if (!xfs_has_zoned(mp)) {
+               if (mp->m_max_open_zones) {
+                       xfs_warn(mp,
+"max_open_zones mount option only supported on zoned file systems.");
+                       return -EINVAL;
+               }
+       }
+
        return 0;
 }
 
@@ -1463,6 +1475,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;