From: Yang Sheng Date: Tue, 18 Oct 2016 04:50:22 +0000 (+0800) Subject: LU-8378 all: remove set but unused variables X-Git-Tag: 2.8.60~22 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b1ff338ede34421acfc2cdbfe0dbe7b293ebd3b2 LU-8378 all: remove set but unused variables Remove set but unused variables as report list. Signed-off-by: Yang Sheng Change-Id: If9120ec088a2dd0b65564330bc295c08a1e579b7 Reviewed-on: http://review.whamcloud.com/23221 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/nidstrings.c b/lnet/lnet/nidstrings.c index 6ad1079..1d292fb 100644 --- a/lnet/lnet/nidstrings.c +++ b/lnet/lnet/nidstrings.c @@ -245,10 +245,8 @@ parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist) { struct cfs_lstr addrrange; struct cfs_lstr net; - struct cfs_lstr tmp; struct nidrange *nr; - tmp = *src; if (cfs_gettok(src, '@', &addrrange) == 0) goto failed; diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 6f3be62..9ce5a45 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -64,7 +64,6 @@ lprocfs_fid_write_common(const char __user *buffer, size_t count, struct lu_seq_range *range) { struct lu_seq_range tmp = { 0, }; - int rc; char kernbuf[MAX_FID_RANGE_STRLEN]; ENTRY; @@ -84,9 +83,9 @@ lprocfs_fid_write_common(const char __user *buffer, size_t count, } /* of the form "[0x0000000240000400 - 0x000000028000400]" */ - rc = sscanf(kernbuf, "[%llx - %llx]\n", - (long long unsigned *)&tmp.lsr_start, - (long long unsigned *)&tmp.lsr_end); + sscanf(kernbuf, "[%llx - %llx]\n", + (long long unsigned *)&tmp.lsr_start, + (long long unsigned *)&tmp.lsr_end); if (!lu_seq_range_is_sane(&tmp) || lu_seq_range_is_zero(&tmp) || tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end) RETURN(-EINVAL); diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index b711f14..975c1cb 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -3643,7 +3643,6 @@ static int mdd_migrate_entries(const struct lu_env *env, struct mdd_object *child; char *name = mdd_env_info(env)->mti_key; int len; - int recsize; int is_dir; bool target_exist = false; @@ -3661,7 +3660,6 @@ static int mdd_migrate_entries(const struct lu_env *env, } fid_le_to_cpu(&ent->lde_fid, &ent->lde_fid); - recsize = le16_to_cpu(ent->lde_reclen); /* Insert new fid with target name into target dir */ if ((ent->lde_namelen == 1 && ent->lde_name[0] == '.') || diff --git a/lustre/mdt/mdt_hsm_cdt_actions.c b/lustre/mdt/mdt_hsm_cdt_actions.c index 14b08f9..7e9b9e9 100644 --- a/lustre/mdt/mdt_hsm_cdt_actions.c +++ b/lustre/mdt/mdt_hsm_cdt_actions.c @@ -365,7 +365,6 @@ static int hsm_actions_show_cb(const struct lu_env *env, struct seq_file *s = data; struct agent_action_iterator *aai; int sz; - size_t count; char buf[12]; ENTRY; @@ -381,7 +380,6 @@ static int hsm_actions_show_cb(const struct lu_env *env, hdr->lrh_index <= aai->aai_index)) RETURN(0); - count = s->count; sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai); seq_printf(s, "lrh=[type=%X len=%d idx=%d/%d] fid="DFID " dfid="DFID" compound/cookie=%#llx/%#llx" diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index a23ac2b..134c829 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -174,14 +174,10 @@ LPROC_SEQ_FOPS(mgs_live); int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb) { - int rc; - if (!mgs->mgs_proc_live) return 0; - rc = lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644, - &mgs_live_fops, fsdb); - - return 0; + return lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644, + &mgs_live_fops, fsdb); } int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb) diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 22c4744..2859cab 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -1311,7 +1311,7 @@ static int mgs_object_init(const struct lu_env *env, struct lu_object *o, else rc = -ENOMEM; - return 0; + return rc; } static void mgs_object_free(const struct lu_env *env, struct lu_object *o) diff --git a/lustre/ofd/ofd_grant.c b/lustre/ofd/ofd_grant.c index a08a5d5..ed92f14 100644 --- a/lustre/ofd/ofd_grant.c +++ b/lustre/ofd/ofd_grant.c @@ -1075,7 +1075,6 @@ void ofd_grant_prepare_write(const struct lu_env *env, int from_cache; int force = 0; /* can use cached data intially */ long chunk = ofd_grant_chunk(exp, ofd, NULL); - int rc; ENTRY; @@ -1117,7 +1116,7 @@ refresh: * space on the server */ spin_unlock(&ofd->ofd_grant_lock); /* discard errors, at least we tried ... */ - rc = dt_sync(env, ofd->ofd_osd); + dt_sync(env, ofd->ofd_osd); force = 2; goto refresh; } diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 9e010b5..957aac5 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -1098,7 +1098,6 @@ static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp, struct obdo *oa) { struct ofd_device *ofd = ofd_exp(exp); - struct ofd_thread_info *info; u64 seq = ostid_seq(&oa->o_oi); struct ofd_seq *oseq; int rc = 0, diff = 1; @@ -1108,7 +1107,7 @@ static int ofd_echo_create(const struct lu_env *env, struct obd_export *exp, ENTRY; - info = ofd_info_init(env, exp); + ofd_info_init(env, exp); LASSERT(seq == FID_SEQ_ECHO); LASSERT(oa->o_valid & OBD_MD_FLGROUP); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index fb3657e..c59c281 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1061,7 +1061,6 @@ static u32 osc_checksum_bulk(int nob, size_t pg_count, int i = 0; struct cfs_crypto_hash_desc *hdesc; unsigned int bufsize; - int err; unsigned char cfs_alg = cksum_obd2cfs(cksum_type); LASSERT(pg_count > 0); @@ -1098,7 +1097,7 @@ static u32 osc_checksum_bulk(int nob, size_t pg_count, } bufsize = sizeof(cksum); - err = cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize); + cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize); /* For sending we only compute the wrong checksum instead * of corrupting the data so it is still correct on a redo */ diff --git a/lustre/osd-ldiskfs/osd_iam.c b/lustre/osd-ldiskfs/osd_iam.c index c197e35..eafe494 100644 --- a/lustre/osd-ldiskfs/osd_iam.c +++ b/lustre/osd-ldiskfs/osd_iam.c @@ -1023,11 +1023,9 @@ static int iam_lookup_lock(struct iam_path *path, */ static int iam_path_lookup(struct iam_path *path, int index) { - struct iam_container *c; struct iam_leaf *leaf; int result; - c = path->ip_container; leaf = &path->ip_leaf; result = iam_lookup_lock(path, &leaf->il_lock, DLT_WRITE); assert_inv(iam_path_check(path)); @@ -1363,13 +1361,11 @@ int iam_index_next(struct iam_container *c, struct iam_path *path) iam_ptr_t cursor; struct dynlock_handle *lh[DX_MAX_TREE_HEIGHT] = { NULL, }; int result; - struct inode *object; /* * Locking for iam_index_next()... is to be described. */ - object = c->ic_object; cursor = path->ip_frame->leaf; while (1) { diff --git a/lustre/osd-ldiskfs/osd_iam_lfix.c b/lustre/osd-ldiskfs/osd_iam_lfix.c index cab8575..9be85c1 100644 --- a/lustre/osd-ldiskfs/osd_iam_lfix.c +++ b/lustre/osd-ldiskfs/osd_iam_lfix.c @@ -485,13 +485,12 @@ static void iam_lfix_split(struct iam_leaf *l, struct buffer_head **bh, * insertion point moves into new leaf. */ int shift; - int result; shift = iam_lfix_diff(l, l->il_at, start); *bh = l->il_bh; l->il_bh = new_leaf; l->il_curidx = new_blknr; - result = iam_lfix_init(l); + iam_lfix_init(l); /* * init cannot fail, as node was just initialized. */ diff --git a/lustre/osd-ldiskfs/osd_iam_lvar.c b/lustre/osd-ldiskfs/osd_iam_lvar.c index be7ed47..abcee4f 100644 --- a/lustre/osd-ldiskfs/osd_iam_lvar.c +++ b/lustre/osd-ldiskfs/osd_iam_lvar.c @@ -725,7 +725,6 @@ static void lvar_split(struct iam_leaf *leaf, struct buffer_head **bh, * insertion point moves into new leaf. */ ptrdiff_t shift; - int result; shift = PDIFF(leaf->il_at, first_to_move); *bh = leaf->il_bh; @@ -733,7 +732,7 @@ static void lvar_split(struct iam_leaf *leaf, struct buffer_head **bh, leaf->il_curidx = new_blknr; assert_corr(iam_leaf_is_locked(leaf)); - result = lvar_init(leaf); + lvar_init(leaf); /* * init cannot fail, as node was just initialized. */ diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 1020ede..b5849aa 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -542,7 +542,6 @@ void qmt_glb_lock_notify(const struct lu_env *env, struct lquota_entry *lqe, struct qmt_thread_info *qti = qmt_info(env); struct qmt_pool_info *pool = lqe2qpi(lqe); struct ldlm_resource *res = NULL; - int rc; ENTRY; lquota_generate_fid(&qti->qti_fid, pool->qpi_key & 0x0000ffff, @@ -568,8 +567,8 @@ void qmt_glb_lock_notify(const struct lu_env *env, struct lquota_entry *lqe, RETURN_EXIT; } - rc = qmt_glimpse_lock(env, pool->qpi_qmt, res, &qti->qti_gl_desc, - NULL, NULL); + qmt_glimpse_lock(env, pool->qpi_qmt, res, &qti->qti_gl_desc, + NULL, NULL); ldlm_resource_putref(res); EXIT; } @@ -602,7 +601,6 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, struct qmt_thread_info *qti = qmt_info(env); struct qmt_pool_info *pool = lqe2qpi(lqe); struct ldlm_resource *res = NULL; - int rc; ENTRY; if (!lqe->lqe_enforced) @@ -652,8 +650,8 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, lqe_write_unlock(lqe); /* issue glimpse callback to slaves */ - rc = qmt_glimpse_lock(env, qmt, res, &qti->qti_gl_desc, - uuid ? qmt_id_lock_cb : NULL, (void *)uuid); + qmt_glimpse_lock(env, qmt, res, &qti->qti_gl_desc, + uuid ? qmt_id_lock_cb : NULL, (void *)uuid); lqe_write_lock(lqe); if (lqe->lqe_revoke_time == 0 && diff --git a/lustre/quota/qsd_lock.c b/lustre/quota/qsd_lock.c index 673b668..11978ac 100644 --- a/lustre/quota/qsd_lock.c +++ b/lustre/quota/qsd_lock.c @@ -379,7 +379,6 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data) { struct ptlrpc_request *req = data; struct lquota_entry *lqe; - struct qsd_instance *qsd; struct ldlm_gl_lquota_desc *desc; struct lquota_lvb *lvb; int rc; @@ -398,8 +397,6 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data) LQUOTA_DEBUG(lqe, "glimpse on quota locks, new qunit:%llu", desc->gl_qunit); - qsd = lqe2qqi(lqe)->qqi_qsd; - lqe_write_lock(lqe); lvb->lvb_id_rel = 0; if (desc->gl_qunit != 0 && desc->gl_qunit != lqe->lqe_qunit) { diff --git a/lustre/quota/qsd_request.c b/lustre/quota/qsd_request.c index 7c382f5..1eb59b2 100644 --- a/lustre/quota/qsd_request.c +++ b/lustre/quota/qsd_request.c @@ -158,7 +158,6 @@ static int qsd_intent_interpret(const struct lu_env *env, { struct lustre_handle *lockh; struct quota_body *rep_qbody = NULL, *req_qbody; - struct ldlm_intent *lit; struct qsd_async_args *aa = (struct qsd_async_args *)arg; __u64 flags = LDLM_FL_HAS_INTENT; ENTRY; @@ -166,7 +165,7 @@ static int qsd_intent_interpret(const struct lu_env *env, LASSERT(aa->aa_exp); lockh = &aa->aa_lockh; req_qbody = req_capsule_client_get(&req->rq_pill, &RMF_QUOTA_BODY); - lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); + req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); rc = ldlm_cli_enqueue_fini(aa->aa_exp, req, LDLM_PLAIN, 0, LCK_CR, &flags, (void *)aa->aa_lvb,