Whamcloud - gitweb
LU-14432 ext2fs: fix ext2fs_get_avg_group() warning
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 31 May 2021 21:08:13 +0000 (15:08 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 19 Sep 2022 23:16:08 +0000 (17:16 -0600)
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>
e2fsck/pass1.c
lib/ext2fs/ext2fs.h

index 808476d..4274847 100644 (file)
@@ -3247,6 +3247,35 @@ out:
        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)
 {
index 416a79d..2ffe8fe 100644 (file)
@@ -2179,35 +2179,6 @@ 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 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