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>
Thu, 15 Dec 2022 22:48:36 +0000 (15:48 -0700)
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/journal.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/util.c
lib/ext2fs/ext_attr.c
lib/ext2fs/ismounted.c
lib/support/devname.c

index 1646b47..270d522 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;
 };
 
@@ -634,7 +634,7 @@ 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",
+       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" :
@@ -809,7 +809,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 d1fdf17..8cb6790 100644 (file)
@@ -1708,7 +1708,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;
@@ -1732,7 +1731,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;
 
@@ -2220,6 +2219,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]);
index 6ca1e99..d45d48b 100644 (file)
@@ -2034,7 +2034,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 b7c1e7a..8579aac 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 201a6ce..d7b4943 100644 (file)
@@ -369,7 +369,8 @@ static int check_lustre_zfs(char *mnt_device, const char *real_devname)
                int line = 0;
                while (!feof(fp)) {
                        memset(buf, 0, PATH_MAX);
-                       fscanf(fp, "%s%*[^\n]", buf);
+                       if (fscanf(fp, "%s%*[^\n]", buf) < 1)
+                               break;
                        /* skip the first line */
                        if (line++ == 0)
                                continue;
index 8c2349a..e0306dd 100644 (file)
@@ -58,7 +58,6 @@ char *get_devname(blkid_cache cache, const char *token, const char *value)
                goto out;
        }
 
-out_strdup:
        if (is_file)
                ret = strdup(token);
 out: