[RFC PATCH 28/46] e2fsck: make threads splitting aware of flex_bg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Wang Shilong <wshilong@xxxxxxx>

Flex_bg might be enabled, if this is enabled it makes
more sense to split based on this.

Signed-off-by: Wang Shilong <wshilong@xxxxxxx>
---
 e2fsck/pass1.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 6789b701..0044d7e8 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2854,6 +2854,23 @@ static void e2fsck_pass1_multithread(e2fsck_t global_ctx)
 	struct e2fsck_thread_info	*infos = NULL;
 	int				 num_threads = 1;
 	errcode_t			 retval;
+	unsigned flexbg_size = 1;
+	int max_threads;
+
+	if (ext2fs_has_feature_flex_bg(global_ctx->fs->super))
+		flexbg_size = 1 << global_ctx->fs->super->s_log_groups_per_flex;
+
+	max_threads = global_ctx->fs->group_desc_count / flexbg_size;
+	if (max_threads == 0)
+		num_threads = 1;
+	else if (max_threads % num_threads) {
+		int times = max_threads / num_threads;
+
+		if (times == 0)
+			num_threads = 1;
+		else
+			num_threads = max_threads / times;
+	}
 
 	init_ext2_max_sizes();
 	retval = e2fsck_pass1_threads_start(&infos, num_threads, global_ctx);
-- 
2.25.2




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux