diff mbox series

[RFC,v3,50/61] e2fsck: move ext2fs_get_avg_group to rw_bitmaps.c

Message ID 20201118153947.3394530-51-saranyamohan@google.com
State New
Headers show
Series Introduce parallel fsck to e2fsck pass1 | expand

Commit Message

Saranya Muruganandam Nov. 18, 2020, 3:39 p.m. UTC
From: Wang Shilong <wshilong@ddn.com>

A bounch of ext2fs_get_avg_group() unused warning messages are
annoying, move it to rw_bitmaps.c to make gcc happy.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ia7d372b7b5aadcbf5d94916f6f67363a2a9f0bfa
Reviewed-on: https://review.whamcloud.com/40060
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Saranya Muruganandam <saranyamohan@google.com>
---
 lib/ext2fs/ext2fs.h     | 29 +----------------------------
 lib/ext2fs/rw_bitmaps.c | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 28 deletions(-)

Comments

Theodore Y. Ts'o Nov. 24, 2020, 2:12 a.m. UTC | #1
On Wed, Nov 18, 2020 at 07:39:36AM -0800, Saranya Muruganandam wrote:
> From: Wang Shilong <wshilong@ddn.com>
> 
> A bounch of ext2fs_get_avg_group() unused warning messages are
> annoying, move it to rw_bitmaps.c to make gcc happy.

This should be merged with the commit that initially defined
ext2fs_get_avg_group() in the first place.

More generally, *all* of the "fix *" commits should be merged with the
original commits.  This will make it **so** much easier to review the
commits.

							- Ted
diff mbox series

Patch

diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 83f2af07..616c9412 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -2122,34 +2122,7 @@  ext2fs_const_inode(const struct ext2_inode_large * large_inode)
 	return (const struct ext2_inode *) large_inode;
 }
 
-static dgrp_t ext2fs_get_avg_group(ext2_filsys fs)
-{
-#ifdef CONFIG_PFSCK
-	dgrp_t average_group;
-	unsigned flexbg_size;
-
-	if (fs->fs_num_threads <= 1)
-		return fs->group_desc_count;
-
-	average_group = fs->group_desc_count / fs->fs_num_threads;
-	if (average_group <= 1)
-		return 1;
-
-	if (ext2fs_has_feature_flex_bg(fs->super)) {
-		int times = 1;
-
-		flexbg_size = 1 << fs->super->s_log_groups_per_flex;
-		if (average_group % flexbg_size) {
-			times = average_group / flexbg_size;
-			average_group = times * flexbg_size;
-		}
-	}
-
-	return average_group;
-#else
-	return fs->group_desc_count;
-#endif
-}
+dgrp_t ext2fs_get_avg_group(ext2_filsys fs);
 
 #undef _INLINE_
 #endif
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 960a6913..95de9b1c 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -515,6 +515,31 @@  struct read_bitmaps_thread_info {
 	io_channel      rbt_io;
 };
 
+dgrp_t ext2fs_get_avg_group(ext2_filsys fs)
+{
+	dgrp_t average_group;
+	unsigned flexbg_size;
+
+	if (fs->fs_num_threads <= 1)
+		return fs->group_desc_count;
+
+	average_group = fs->group_desc_count / fs->fs_num_threads;
+	if (average_group <= 1)
+		return 1;
+
+	if (ext2fs_has_feature_flex_bg(fs->super)) {
+		int times = 1;
+
+		flexbg_size = 1 << fs->super->s_log_groups_per_flex;
+		if (average_group % flexbg_size) {
+			times = average_group / flexbg_size;
+			average_group = times * flexbg_size;
+		}
+	}
+
+	return average_group;
+}
+
 static void* read_bitmaps_thread(void *data)
 {
 	struct read_bitmaps_thread_info *rbt = data;