Whamcloud - gitweb
LU-16067 misc: cleanup compiler warnings
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 2 Aug 2022 23:08:19 +0000 (17:08 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 19 Sep 2022 20:05:13 +0000 (14:05 -0600)
Remove unused variables and various similar warnings.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2a773d118960deb42f77c1ae8b038029e6f6cd18
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
e2fsck/dirinfo.c
e2fsck/e2fsck.h
e2fsck/journal.c
e2fsck/logfile.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/util.c
lib/ext2fs/ext_attr.c
lib/ext2fs/swapfs.c

index b4adaa6..322f4da 100644 (file)
@@ -294,8 +294,7 @@ out:
  */
 void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
 {
-       struct dir_info         *dir, *old_array;
-       ext2_ino_t              i, j;
+       struct dir_info         *old_array;
        errcode_t               retval;
        unsigned long           old_size;
 
index 389ad58..43051be 100644 (file)
@@ -306,7 +306,7 @@ struct e2fsck_thread {
        dgrp_t          et_group_next;
        /* Scanned inode number */
        ext2_ino_t      et_inode_number;
-       char            et_log_length;
+       int             et_log_length;
        char            et_log_buf[2048];
 };
 #endif
index 2e86723..b3a5230 100644 (file)
@@ -578,7 +578,7 @@ static int ext4_del_extent_from_list(e2fsck_t ctx, struct extent_list *list,
        return ext4_modify_extent_list(ctx, list, ex, 1 /* delete */);
 }
 
-static int ext4_fc_read_extents(e2fsck_t ctx, ino_t ino)
+static int ext4_fc_read_extents(e2fsck_t ctx, ext2_ino_t ino)
 {
        struct extent_list *extent_list = &ctx->fc_replay_state.fc_extent_list;
 
@@ -597,7 +597,7 @@ static int ext4_fc_read_extents(e2fsck_t ctx, ino_t ino)
  * for the inode so that we can flush all of them at once and it also saves us
  * from continuously growing and shrinking the extent tree.
  */
-static void ext4_fc_flush_extents(e2fsck_t ctx, ino_t ino)
+static void ext4_fc_flush_extents(e2fsck_t ctx, ext2_ino_t ino)
 {
        struct extent_list *extent_list = &ctx->fc_replay_state.fc_extent_list;
 
@@ -610,9 +610,9 @@ static void ext4_fc_flush_extents(e2fsck_t ctx, ino_t ino)
 
 /* Helper struct for dentry replay routines */
 struct dentry_info_args {
-       ino_t parent_ino;
+       ext2_ino_t parent_ino;
        int dname_len;
-       ino_t ino;
+       ext2_ino_t ino;
        char *dname;
 };
 
@@ -620,7 +620,6 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
                             struct  ext4_fc_tl *tl, __u8 *val)
 {
        struct ext4_fc_dentry_info fcd;
-       int tag = le16_to_cpu(tl->fc_tag);
 
        memcpy(&fcd, val, sizeof(fcd));
 
@@ -635,11 +634,11 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
               val + sizeof(struct ext4_fc_dentry_info),
               darg->dname_len);
        darg->dname[darg->dname_len] = 0;
-       jbd_debug(1, "%s: %s, ino %lu, parent %lu\n",
-               tag == EXT4_FC_TAG_CREAT ? "create" :
-               (tag == EXT4_FC_TAG_LINK ? "link" :
-               (tag == EXT4_FC_TAG_UNLINK ? "unlink" : "error")),
-               darg->dname, darg->ino, darg->parent_ino);
+       jbd_debug(1, "%s: %s, ino %d, parent %d\n",
+                 le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
+                 (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
+                  (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
+                   "error")), darg->dname, darg->ino, darg->parent_ino);
        return 0;
 }
 
@@ -652,11 +651,11 @@ static int ext4_fc_handle_unlink(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val)
        if (ret)
                return ret;
        ext4_fc_flush_extents(ctx, darg.ino);
-       ret = errcode_to_errno(
-                      ext2fs_unlink(ctx->fs, darg.parent_ino,
-                                    darg.dname, darg.ino, 0));
+       ret = errcode_to_errno(ext2fs_unlink(ctx->fs, darg.parent_ino,
+                                            darg.dname, darg.ino, 0));
        /* It's okay if the above call fails */
        free(darg.dname);
+
        return ret;
 }
 
@@ -800,7 +799,7 @@ static int ext4_fc_handle_add_extent(e2fsck_t ctx, __u8 *val)
 {
        struct ext2fs_extent extent;
        struct ext4_fc_add_range add_range;
-       ino_t ino;
+       ext2_ino_t ino;
        int ret = 0;
 
        memcpy(&add_range, val, sizeof(add_range));
index 60ab95f..1d71d8c 100644 (file)
@@ -292,7 +292,6 @@ static FILE *set_up_log_file(e2fsck_t ctx, const char *key, const char *fn)
        struct string s, s1, s2;
        char *s0 = 0, *log_dir = 0, *log_fn = 0;
        int log_dir_wait = 0;
-       int string_size;
        char string_index[10];
 
        s.s = s1.s = s2.s = 0;
index c57fcc0..85a21c8 100644 (file)
@@ -1703,7 +1703,6 @@ static int precreated_object(struct ext2_inode *inode)
 
 void e2fsck_pass1_run(e2fsck_t ctx)
 {
-       int     i;
        ext2_filsys fs = ctx->fs;
        ext2_ino_t      ino = 0;
        struct ext2_inode *inode = NULL;
@@ -1727,7 +1726,7 @@ void e2fsck_pass1_run(e2fsck_t ctx)
        dgrp_t          ra_group = 0;
        struct ea_quota ea_ibody_quota;
        struct process_inode_block *inodes_to_process;
-       int             process_inode_count, check_mmp;
+       int             process_inode_count, check_mmp = 0;
        e2fsck_t        global_ctx = ctx->global_ctx ? ctx->global_ctx : ctx;
        int             inode_exp = 0;
 
@@ -2215,6 +2214,7 @@ void e2fsck_pass1_run(e2fsck_t ctx)
                        void *ehp;
 #ifdef WORDS_BIGENDIAN
                        __u32 tmp_block[EXT2_N_BLOCKS];
+                       int i;
 
                        for (i = 0; i < EXT2_N_BLOCKS; i++)
                                tmp_block[i] = ext2fs_swab32(inode->i_block[i]);
@@ -2939,7 +2939,6 @@ static void e2fsck_pass1_copy_invalid_bitmaps(e2fsck_t global_ctx,
 static void e2fsck_pass1_merge_invalid_bitmaps(e2fsck_t global_ctx,
                                               e2fsck_t thread_ctx)
 {
-       dgrp_t i, j;
        dgrp_t grp_start = thread_ctx->thread_info.et_group_start;
        dgrp_t grp_end = thread_ctx->thread_info.et_group_end;
        dgrp_t total = grp_end - grp_start;
@@ -3879,7 +3878,6 @@ void e2fsck_mark_inode_bad_loc(e2fsck_t ctx, struct problem_context *pctx,
                               const int line)
 {
        __u16 badness_before, badness_after;
-       __u64 pctx_num_sav = pctx->num;
 
        if (!ctx->inode_badness_threshold)      /* badness is disabled */
                return;
index 830adb9..505414e 100644 (file)
@@ -2035,7 +2035,6 @@ int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
        unsigned char           *frag, *fsize;
        struct problem_context  pctx;
        problem_t               problem = 0;
-       __u16                   badness = 0;
        unsigned int            flags = ctx->fs->flags;
 
        flags = ctx->fs->flags;
index 7dd565c..6dff68e 100644 (file)
@@ -107,7 +107,6 @@ void log_out(e2fsck_t ctx, const char *fmt, ...)
        int buf_size;
        int msg_size;
        int left_size;
-       int fmt_length = strlen(fmt);
 
 #ifdef HAVE_PTHREAD
        if ((ctx->options & E2F_OPT_MULTITHREAD) && ctx->global_ctx) {
index 00b3bbf..04c560e 100644 (file)
@@ -1034,7 +1034,6 @@ errcode_t ext2fs_xattrs_read_inode(struct ext2_xattr_handle *handle,
        unsigned int storage_size;
        char *start, *block_buf = NULL;
        blk64_t blk;
-       size_t i;
        errcode_t err;
 
        EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE);
index 1006b2d..cd160b3 100644 (file)
@@ -244,7 +244,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
                            int bufsize)
 {
        unsigned i, extra_isize, attr_magic;
-       int has_extents, has_inline_data, islnk, fast_symlink;
+       int has_extents = 0, has_inline_data = 0, islnk = 0, fast_symlink = 0;
        unsigned int inode_size;
        __u32 *eaf, *eat;