From 4ae43732a55363ea382d0e2f049948c3014f80e9 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 2 Aug 2022 17:08:19 -0600 Subject: [PATCH] LU-16067 misc: cleanup compiler warnings Remove unused variables and various similar warnings. Signed-off-by: Andreas Dilger Change-Id: I2a773d118960deb42f77c1ae8b038029e6f6cd18 Reviewed-by: Artem Blagodarenko Reviewed-by: Li Dongyang --- e2fsck/journal.c | 12 ++++++------ e2fsck/pass1.c | 4 ++-- e2fsck/pass2.c | 1 - e2fsck/util.c | 1 - lib/ext2fs/ext_attr.c | 1 - lib/ext2fs/ismounted.c | 3 ++- lib/support/devname.c | 1 - 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 1646b47..270d522 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -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)); diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index d1fdf17..8cb6790 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -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]); diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 6ca1e99..d45d48b 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -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; diff --git a/e2fsck/util.c b/e2fsck/util.c index b7c1e7a..8579aac 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -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) { diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index 00b3bbf..04c560e 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -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); diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index 201a6ce..d7b4943 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -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; diff --git a/lib/support/devname.c b/lib/support/devname.c index 8c2349a..e0306dd 100644 --- a/lib/support/devname.c +++ b/lib/support/devname.c @@ -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: -- 1.8.3.1