From: "Darrick J. Wong" <djwong@kernel.org>
To: linux-xfs@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 5.1/10] xfs: create mount option to override metadata threads
Date: Tue, 19 Jan 2021 20:30:05 -0800 [thread overview]
Message-ID: <20210120043005.GW3134581@magnolia> (raw)
In-Reply-To: <161100800882.90204.6003697594198832699.stgit@magnolia>
From: Darrick J. Wong <djwong@kernel.org>
Create a mount option so that sysadmins can override the estimated
parallelism of the filesystem, which in turn controls the number of
active work items in background threads.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_mount.h | 3 +++
fs/xfs/xfs_pwork.c | 5 +++++
fs/xfs/xfs_super.c | 22 ++++++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index dfa429b77ee2..884a49972789 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -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
diff --git a/fs/xfs/xfs_pwork.c b/fs/xfs/xfs_pwork.c
index 53606397ff54..e89fb47bdfd6 100644
--- a/fs/xfs/xfs_pwork.c
+++ b/fs/xfs/xfs_pwork.c
@@ -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
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d17fbdb2a656..2f8c512fca10 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -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;
}
next prev parent reply other threads:[~2021-01-20 4:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 22:13 [PATCHSET v3 00/10] xfs: consolidate posteof and cowblocks cleanup Darrick J. Wong
2021-01-18 22:13 ` [PATCH 01/10] xfs: relocate the eofb/cowb workqueue functions Darrick J. Wong
2021-01-19 7:12 ` Christoph Hellwig
2021-01-18 22:13 ` [PATCH 02/10] xfs: hide xfs_icache_free_eofblocks Darrick J. Wong
2021-01-19 7:13 ` Christoph Hellwig
2021-01-18 22:13 ` [PATCH 03/10] xfs: hide xfs_icache_free_cowblocks Darrick J. Wong
2021-01-19 7:14 ` Christoph Hellwig
2021-01-18 22:13 ` [PATCH 04/10] xfs: remove trivial eof/cowblocks functions Darrick J. Wong
2021-01-19 7:16 ` Christoph Hellwig
2021-01-18 22:13 ` [PATCH 05/10] xfs: increase the default parallelism levels of pwork clients Darrick J. Wong
2021-01-20 4:30 ` Darrick J. Wong [this message]
2021-01-20 23:34 ` Darrick J. Wong
2021-01-18 22:13 ` [PATCH 06/10] xfs: consolidate incore inode radix tree posteof/cowblocks tags Darrick J. Wong
2021-01-18 22:13 ` [PATCH 07/10] xfs: consolidate the eofblocks and cowblocks workers Darrick J. Wong
2021-01-19 7:17 ` Christoph Hellwig
2021-01-18 22:13 ` [PATCH 08/10] xfs: only walk the incore inode tree once per blockgc scan Darrick J. Wong
2021-01-18 22:13 ` [PATCH 09/10] xfs: rename block gc start and stop functions Darrick J. Wong
2021-01-18 22:13 ` [PATCH 10/10] xfs: parallelize block preallocation garbage collection Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210120043005.GW3134581@magnolia \
--to=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox