From: Ammar Faizi <[email protected]>
To: Chris Mason <[email protected]>, Josef Bacik <[email protected]>,
David Sterba <[email protected]>, Tejun Heo <[email protected]>
Cc: Ammar Faizi <[email protected]>,
Lai Jiangshan <[email protected]>,
Filipe Manana <[email protected]>,
Linux Btrfs Mailing List <[email protected]>,
Linux Kernel Mailing List <[email protected]>,
Linux Fsdevel Mailing List <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [RFC PATCH v1 6/6] btrfs: Add `BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE` macro
Date: Sun, 26 Feb 2023 23:02:59 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Currently, the default max thread pool size is hardcoded as 8. This
number is not only used in one place. Keep the default max thread pool
size in sync by introducing a new macro.
Signed-off-by: Ammar Faizi <[email protected]>
---
fs/btrfs/async-thread.h | 2 ++
fs/btrfs/disk-io.c | 3 ++-
fs/btrfs/super.c | 3 ++-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
index 2b8a76fa75ef9e69..f11c3b36568053be 100644
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -9,6 +9,8 @@
#include <linux/workqueue.h>
+#define BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE 8
+
struct btrfs_fs_info;
struct btrfs_workqueue;
struct btrfs_work;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1bb1db461a30fa71..4f4ddc8e088b08ec 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2957,7 +2957,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
btrfs_init_ref_verify(fs_info);
fs_info->thread_pool_size = min_t(unsigned long,
- num_online_cpus() + 2, 8);
+ num_online_cpus() + 2,
+ BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE);
INIT_LIST_HEAD(&fs_info->ordered_roots);
spin_lock_init(&fs_info->ordered_root_lock);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 34b7c5810d34d624..bf4be383e289ef6c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -333,7 +333,8 @@ static void adjust_default_thread_pool_size(struct btrfs_fs_info *info)
}
old_thread_pool_size = info->thread_pool_size;
- new_thread_pool_size = min_t(unsigned long, total_usable_cpu + 2, 8);
+ new_thread_pool_size = min_t(unsigned long, total_usable_cpu + 2,
+ BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE);
if (old_thread_pool_size == new_thread_pool_size)
return;
--
Ammar Faizi
next prev parent reply other threads:[~2023-02-26 16:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 16:02 [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 1/6] workqueue: Add set_workqueue_cpumask() helper function Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 2/6] btrfs: Change `mount_opt` type in `struct btrfs_fs_info` to `u64` Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 3/6] btrfs: Create btrfs CPU set struct and helpers Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 4/6] btrfs: Add wq_cpu_set=%s mount option Ammar Faizi
2023-02-26 16:02 ` [RFC PATCH v1 5/6] btrfs: Adjust the default thread pool size when `wq_cpu_set` option is used Ammar Faizi
2023-02-26 16:02 ` Ammar Faizi [this message]
2023-02-26 17:01 ` [RFC PATCH v1 0/6] Introducing `wq_cpu_set` mount option for btrfs Tejun Heo
2023-02-26 18:26 ` Ammar Faizi
2023-02-26 18:29 ` Ammar Faizi
2023-02-27 10:18 ` Qu Wenruo
2023-02-27 13:42 ` Ammar Faizi
2023-02-27 23:49 ` Qu Wenruo
2023-02-27 11:02 ` Filipe Manana
[not found] ` <[email protected]>
2023-02-27 13:45 ` Ammar Faizi
2023-02-27 16:24 ` Roman Mamedov
2023-02-27 22:17 ` Dave Chinner
2023-02-28 8:01 ` Ammar Faizi
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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