Move ext2fs_get_avg_group() into e2fsck/pass1.c instead of the
ext2fs.h header, since it is currently only used in that one
function. It is too large to be a static inline function, and
it is currently causing many compile warnings because it is
not marked with "_INLINE_".
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ie948bc10f44dccf91558099a5217ea1fb5ce7057
Reviewed-on: https://review.whamcloud.com/43881
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
return NULL;
}
+static dgrp_t ext2fs_get_avg_group(ext2_filsys fs)
+{
+#ifdef HAVE_PTHREAD
+ 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
+}
+
static int e2fsck_pass1_threads_start(struct e2fsck_thread_info **pinfo,
e2fsck_t global_ctx)
{
return (const struct ext2_inode *) large_inode;
}
-static dgrp_t ext2fs_get_avg_group(ext2_filsys fs)
-{
-#ifdef HAVE_PTHREAD
- 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
-}
-
#undef _INLINE_
#endif