@@ -209,6 +209,9 @@ typedef struct xfs_mount {
struct mutex m_growlock; /* growfs mutex */
#ifdef DEBUG
+ /* Desired parallelism of threaded tasks and background workers. */
+ unsigned int m_metadata_threads;
+
/*
* Frequency with which errors are injected. Replaces xfs_etest; the
* value stored in here is the inverse of the frequency with which the
@@ -162,6 +162,11 @@ xfs_pwork_guess_metadata_threads(
{
unsigned int threads;
+#ifdef DEBUG
+ if (mp->m_metadata_threads > 0)
+ return mp->m_metadata_threads;
+#endif
+
/*
* Estimate the amount of parallelism for metadata operations from the
* least capable of the two devices that handle metadata. Cap that
@@ -93,6 +93,9 @@ enum {
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,
+#ifdef DEBUG
+ Opt_metadata_threads,
+#endif
};
static const struct fs_parameter_spec xfs_fs_parameters[] = {
@@ -137,6 +140,9 @@ 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),
+#ifdef DEBUG
+ fsparam_u32("metadata_threads", Opt_metadata_threads),
+#endif
{}
};
@@ -222,6 +228,11 @@ xfs_fs_show_options(
if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
seq_puts(m, ",noquota");
+#ifdef DEBUG
+ if (mp->m_metadata_threads > 0)
+ seq_printf(m, ",metadata_threads=%u", mp->m_metadata_threads);
+#endif
+
return 0;
}
@@ -1291,6 +1302,12 @@ xfs_fs_parse_param(
case Opt_dax_enum:
xfs_mount_set_dax_mode(mp, result.uint_32);
return 0;
+#endif
+#ifdef DEBUG
+ case Opt_metadata_threads:
+ xfs_warn(mp, "%s set to %u", param->key, result.uint_32);
+ mp->m_metadata_threads = result.uint_32;
+ return 0;
#endif
/* Following mount options will be removed in September 2025 */
case Opt_ikeep:
@@ -1831,6 +1848,11 @@ xfs_fs_reconfigure(
return error;
}
+#ifdef DEBUG
+ mp->m_metadata_threads = new_mp->m_metadata_threads;
+ xfs_configure_background_workqueues(mp);
+#endif
+
return 0;
}