@@ -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;
@@ -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);
@@ -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;
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 <ammarfaizi2@gnuweeb.org> --- fs/btrfs/async-thread.h | 2 ++ fs/btrfs/disk-io.c | 3 ++- fs/btrfs/super.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-)