From: yangsheng Date: Thu, 8 Sep 2011 17:33:25 +0000 (+0800) Subject: LU-506 kernel: FC15 - fix GCC 'set-but-unused' warnings X-Git-Tag: 2.1.53~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a5b81807c5d6d2cb3b2ef1a0a7e150ee6002f7f7 LU-506 kernel: FC15 - fix GCC 'set-but-unused' warnings Eliminate a number of unused variables in the code that caused GCC-4.6.0 to warn about "set-but-unused variables". In some cases the variables are only used in conditionally-compiled code, so they are used in some way just to quiet the compiler. Signed-off-by: Yang Sheng Change-Id: I8b9b744c787fff4057722420866adea86d8240f5 Reviewed-on: http://review.whamcloud.com/1330 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index bfdaea2..10a8583 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -124,10 +124,9 @@ LB_LINUX_TRY_COMPILE([ #include #include ],[ - unsigned long long *data1; - __u64 *data2 = NULL; + unsigned long long *data; - data1 = data2; + data = (__u64*)sizeof(data); ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_KERN__U64_LONG_LONG, 1, @@ -144,13 +143,10 @@ AC_DEFUN([LIBCFS_TASK_RCU], LB_LINUX_TRY_COMPILE([ #include ],[ - struct task_struct tsk; - - tsk.rcu.next = NULL; + memset(((struct task_struct *)0)->rcu.next, 0, 0); ],[ AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_TASK_RCU, 1, - [task_struct has rcu field]) + AC_DEFINE(HAVE_TASK_RCU, 1, [task_struct has rcu field]) ],[ AC_MSG_RESULT([no]) ]) @@ -482,11 +478,9 @@ AC_DEFUN([LIBCFS_FUNC_DUMP_TRACE], LB_LINUX_TRY_COMPILE([ struct task_struct; struct pt_regs; - void print_addr(void *data, unsigned long addr, int reliable); #include ],[ - struct stacktrace_ops ops; - ops.address = print_addr; + ((struct stacktrace_ops *)0)->address(NULL, 0, 0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1, @@ -561,7 +555,7 @@ LB_LINUX_TRY_COMPILE([ ],[ uid_t uid; - uid = current_uid(); + uid = current_uid() + sizeof(uid); ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_CRED_WRAPPERS, 1, [task's cred wrappers found]) @@ -643,17 +637,8 @@ AC_DEFUN([LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK], [AC_MSG_CHECKING([if 'struct stacktrace_ops' has 'walk_stack' field]) LB_LINUX_TRY_COMPILE([ #include - unsigned long walkstack(struct thread_info *tinfo, - unsigned long *stack, - unsigned long bp, - const struct stacktrace_ops *ops, - void *data, - unsigned long *end, - int *graph); ],[ - struct stacktrace_ops ops; - - ops.walk_stack = walkstack; + ((struct stacktrace_ops *)0)->walk_stack(NULL, NULL, 0, NULL, NULL, NULL, NULL); ],[ AC_MSG_RESULT([yes]) AC_DEFINE(STACKTRACE_OPS_HAVE_WALK_STACK, 1, ['struct stacktrace_ops' has 'walk_stack' field]) @@ -697,9 +682,7 @@ AC_DEFUN([LIBCFS_OOMADJ_IN_SIG], LB_LINUX_TRY_COMPILE([ #include ],[ - struct signal_struct s; - - s.oom_adj = 0; + ((struct signal_struct *)0)->oom_adj = 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OOMADJ_IN_SIG, 1, diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 863ca3a..1a47def 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -328,6 +328,8 @@ static inline void *__container_of(void *ptr, unsigned long shift) #define container_of0(ptr, type, member) \ ((type *)__container_of((void *)(ptr), offsetof(type, member))) +#define SET_BUT_UNUSED(a) do { } while(sizeof(a) - sizeof(a)) + #define _LIBCFS_H #endif /* _LIBCFS_H */ diff --git a/libcfs/include/libcfs/libcfs_fail.h b/libcfs/include/libcfs/libcfs_fail.h index b9dcd6b..5edd20d 100644 --- a/libcfs/include/libcfs/libcfs_fail.h +++ b/libcfs/include/libcfs/libcfs_fail.h @@ -127,14 +127,15 @@ static inline int cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set) * the first and continues. */ static inline void cfs_race(__u32 id) { - int rc; if (CFS_FAIL_PRECHECK(id)) { if (unlikely(__cfs_fail_check_set(id, 0, CFS_FAIL_LOC_NOSET))) { + int rc; cfs_race_state = 0; CERROR("cfs_race id %x sleeping\n", id); - cfs_wait_event_interruptible(cfs_race_waitq, cfs_race_state != 0, rc); - CERROR("cfs_fail_race id %x awake\n", id); + cfs_wait_event_interruptible(cfs_race_waitq, + cfs_race_state != 0, rc); + CERROR("cfs_fail_race id %x awake, rc=%d\n", id, rc); } else { CERROR("cfs_fail_race id %x waking\n", id); cfs_race_state = 1; diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index 82810ad..b7ba6e6 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -265,7 +265,7 @@ do { \ # else # define LIBCFS_ALLOC(ptr, size) do { (ptr) = calloc(1,size); } while (0) # endif -# define LIBCFS_FREE(a, b) do { free(a); } while (0) +# define LIBCFS_FREE(ptr, size) do { free(ptr); } while((size) - (size)) void libcfs_debug_dumplog(void); int libcfs_debug_init(unsigned long bufsize); diff --git a/libcfs/libcfs/nidstrings.c b/libcfs/libcfs/nidstrings.c index 681dcd1..9f75501 100644 --- a/libcfs/libcfs/nidstrings.c +++ b/libcfs/libcfs/nidstrings.c @@ -78,8 +78,8 @@ void libcfs_init_nidstrings (void) # define NIDSTR_LOCK(f) cfs_spin_lock_irqsave(&libcfs_nidstring_lock, f) # define NIDSTR_UNLOCK(f) cfs_spin_unlock_irqrestore(&libcfs_nidstring_lock, f) #else -# define NIDSTR_LOCK(f) (f=0) /* avoid unused var warnings */ -# define NIDSTR_UNLOCK(f) (f=0) +# define NIDSTR_LOCK(f) (f=sizeof(f)) /* avoid set-but-unused warnings */ +# define NIDSTR_UNLOCK(f) (f=sizeof(f)) #endif static char * diff --git a/libcfs/libcfs/workitem.c b/libcfs/libcfs/workitem.c index d3bdf68..69bd052 100644 --- a/libcfs/libcfs/workitem.c +++ b/libcfs/libcfs/workitem.c @@ -414,8 +414,7 @@ int cfs_wi_startup (void) { int i; - int n; - int rc; + int n, rc; cfs_wi_data.wi_nthreads = 0; cfs_wi_data.wi_nsched = CFS_WI_NSCHED; @@ -440,7 +439,8 @@ cfs_wi_startup (void) } } #else - n = rc = 0; + SET_BUT_UNUSED(rc); + SET_BUT_UNUSED(n); #endif return 0; diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index fc25673..4cf824e 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -137,8 +137,8 @@ lnet_get_networks (void) return (rc == 0) ? networks : NULL; } #else - ip2nets = NULL; - rc = 0; + SET_BUT_UNUSED(ip2nets); + SET_BUT_UNUSED(rc); #endif if (networks != NULL) return networks; diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index b7d6c85..c82ff8e 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -1127,13 +1127,10 @@ lnet_router_checker(void *arg) int rc; lnet_peer_t *rtr; cfs_list_t *entry; - lnet_process_id_t rtr_id; cfs_daemonize("router_checker"); cfs_block_allsigs(); - rtr_id.pid = LUSTRE_SRV_LNET_PID; - LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c index 94074ae..bd9aa92 100644 --- a/lnet/selftest/conrpc.c +++ b/lnet/selftest/conrpc.c @@ -427,7 +427,6 @@ void lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) { lstcon_rpc_t *crpc; - srpc_client_rpc_t *rpc; srpc_msg_t *rep; int error; @@ -439,8 +438,6 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) lstcon_rpc_t, crp_link) { lstcon_rpc_stat_total(stat, 1); - rpc = crpc->crp_rpc; - LASSERT (crpc->crp_stamp != 0); error = lstcon_rpc_get_reply(crpc, &rep); @@ -478,7 +475,6 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, cfs_list_t *next; lstcon_rpc_ent_t *ent; srpc_generic_reply_t *rep; - srpc_client_rpc_t *rpc; lstcon_rpc_t *crpc; srpc_msg_t *msg; lstcon_node_t *nd; @@ -503,8 +499,6 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, ent = cfs_list_entry(next, lstcon_rpc_ent_t, rpe_link); - rpc = crpc->crp_rpc; - LASSERT (crpc->crp_stamp != 0); error = lstcon_rpc_get_reply(crpc, &msg); diff --git a/lnet/selftest/timer.c b/lnet/selftest/timer.c index 96240bb..c71fc0f 100644 --- a/lnet/selftest/timer.c +++ b/lnet/selftest/timer.c @@ -181,6 +181,8 @@ stt_timer_main (void *arg) int rc = 0; UNUSED(arg); + SET_BUT_UNUSED(rc); + cfs_daemonize("st_timer"); cfs_block_allsigs(); diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 8aca02a..aab0c97 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -909,7 +909,6 @@ static int jt_dbg_modules_2_5(int argc, char **argv) { struct mod_paths *mp; char *path = ""; - char *kernel = "linux"; const char *proc = "/proc/modules"; char modname[128], buf[4096]; long modaddr; @@ -917,8 +916,6 @@ static int jt_dbg_modules_2_5(int argc, char **argv) if (argc >= 2) path = argv[1]; - if (argc == 3) - kernel = argv[2]; if (argc > 3) { printf("%s [path] [kernel]\n", argv[0]); return 0; diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 455ec77..043d1db 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1220,34 +1220,6 @@ LB_LINUX_TRY_COMPILE([ ]) ]) -# LC_VFS_READDIR_U64_INO -# 2.6.19 use u64 for inode number instead of inode_t -AC_DEFUN([LC_VFS_READDIR_U64_INO], -[AC_MSG_CHECKING([check vfs_readdir need 64bit inode number]) -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_LINUX_TRY_COMPILE([ -#include - int fillonedir(void * __buf, const char * name, int namlen, loff_t offset, - u64 ino, unsigned int d_type) - { - return 0; - } -],[ - filldir_t filter; - - filter = fillonedir; - return 1; -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1, - [if vfs_readdir need 64bit inode number]) -],[ - AC_MSG_RESULT(no) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) - # LC_FILE_WRITEV # 2.6.19 replaced writev with aio_write AC_DEFUN([LC_FILE_WRITEV], @@ -1365,7 +1337,7 @@ LB_LINUX_TRY_COMPILE([ #include ],[ struct crypto_blkcipher *tfm; - tfm = crypto_alloc_blkcipher("aes", 0, 0 ); + tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) ); ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support]) @@ -1570,15 +1542,13 @@ LB_LINUX_TRY_COMPILE([ AC_DEFUN([LC_FH_TO_DENTRY], [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct]) LB_LINUX_TRY_COMPILE([ + #include #ifdef HAVE_LINUX_EXPORTFS_H #include -#else - #include #endif ],[ struct export_operations exp; - - exp.fh_to_dentry = NULL; + memset(exp.fh_to_dentry, 0, sizeof(exp.fh_to_dentry)); ], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FH_TO_DENTRY, 1, @@ -1596,7 +1566,7 @@ LB_LINUX_TRY_COMPILE([ ],[ struct proc_dir_entry pde; - pde.deleted = NULL; + pde.deleted = sizeof(pde); ], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_PROCFS_DELETED, 1, @@ -1650,6 +1620,7 @@ LB_LINUX_TRY_COMPILE([ struct fs_struct fs; fs.pwd = path; + memset(&fs, 0, sizeof(fs)); ], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1, @@ -1813,7 +1784,7 @@ LB_LINUX_TRY_COMPILE([ #include ],[ struct bio io; - io.bi_hw_segments = 0; + io.bi_hw_segments = sizeof(io); ],[ AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1, [struct bio has a bi_hw_segments field]) @@ -2254,7 +2225,6 @@ AC_DEFUN([LC_PROG_LINUX], # 2.6.19 LC_INODE_BLKSIZE - LC_VFS_READDIR_U64_INO LC_FILE_WRITEV LC_FILE_READV diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index 66ce462..c09cf0cf 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -113,12 +113,10 @@ int seq_store_write(struct lu_server_seq *seq, { struct dt_object *dt_obj = seq->lss_obj; struct seq_thread_info *info; - struct dt_device *dt_dev; loff_t pos = 0; int rc; ENTRY; - dt_dev = lu2dt_dev(seq->lss_obj->do_lu.lo_dev); info = lu_context_key_get(&env->le_ctx, &seq_thread_key); LASSERT(info != NULL); diff --git a/lustre/fld/fld_index.c b/lustre/fld/fld_index.c index dd7b1de..997e781 100644 --- a/lustre/fld/fld_index.c +++ b/lustre/fld/fld_index.c @@ -153,7 +153,6 @@ int fld_index_create(struct lu_server_fld *fld, struct thandle *th) { struct dt_object *dt_obj = fld->lsf_obj; - struct dt_device *dt_dev; seqno_t start; int rc; @@ -161,7 +160,6 @@ int fld_index_create(struct lu_server_fld *fld, start = range->lsr_start; LASSERT(range_is_sane(range)); - dt_dev = lu2dt_dev(fld->lsf_obj->do_lu.lo_dev); rc = dt_obj->do_index_ops->dio_insert(env, dt_obj, fld_rec(env, range), @@ -189,13 +187,11 @@ int fld_index_delete(struct lu_server_fld *fld, struct thandle *th) { struct dt_object *dt_obj = fld->lsf_obj; - struct dt_device *dt_dev; seqno_t seq = range->lsr_start; int rc; ENTRY; - dt_dev = lu2dt_dev(fld->lsf_obj->do_lu.lo_dev); rc = dt_obj->do_index_ops->dio_delete(env, dt_obj, fld_key(env, seq), th, BYPASS_CAPA); diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index be0d684..499385dd 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -806,6 +806,7 @@ do { \ } \ } \ } \ + SET_BUT_UNUSED(wq); \ } while (0) #endif /* __KERNEL__ */ diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index 7e8a754..a3437b4 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -653,14 +653,11 @@ EXPORT_SYMBOL(ldlm_flock_completion_ast); int ldlm_flock_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, void *data, int flag) { - struct ldlm_namespace *ns; ENTRY; LASSERT(lock); LASSERT(flag == LDLM_CB_CANCELING); - ns = ldlm_lock_to_ns(lock); - /* take lock off the deadlock detection waitq. */ cfs_spin_lock(&ldlm_flock_waitq_lock); cfs_list_del_init(&lock->l_flock_waitq); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 2821552..98629a6 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -2211,7 +2211,6 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) { int netrc; struct ptlrpc_reply_state *rs; - struct obd_device *obd; struct obd_export *exp; struct ptlrpc_service *svc; ENTRY; @@ -2245,7 +2244,6 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) LASSERT (cfs_list_empty(&rs->rs_exp_list)); exp = class_export_get (req->rq_export); - obd = exp->exp_obd; /* disable reply scheduling while I'm setting up */ rs->rs_scheduled = 1; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 1b80090..af7c6c4 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -279,7 +279,7 @@ static int ldlm_lock_busy(struct ldlm_lock *lock) /* This is called from within a timer interrupt and cannot schedule */ static void waiting_locks_callback(unsigned long unused) { - struct ldlm_lock *lock, *last = NULL; + struct ldlm_lock *lock; repeat: cfs_spin_lock_bh(&waiting_locks_spinlock); @@ -355,8 +355,6 @@ repeat: libcfs_nid2str( lock->l_export->exp_connection->c_peer.nid)); - last = lock; - /* no needs to take an extra ref on the lock since it was in * the waiting_locks_list and ldlm_add_waiting_lock() * already grabbed a ref */ diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index e73b91a..d95e6df 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -703,7 +703,7 @@ int ldlm_prep_elc_req(struct obd_export *exp, struct ptlrpc_request *req, struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; struct req_capsule *pill = &req->rq_pill; struct ldlm_request *dlm = NULL; - int flags, avail, to_free, bufcount, pack = 0; + int flags, avail, to_free, pack = 0; CFS_LIST_HEAD(head); int rc; ENTRY; @@ -712,7 +712,7 @@ int ldlm_prep_elc_req(struct obd_export *exp, struct ptlrpc_request *req, cancels = &head; if (exp_connect_cancelset(exp)) { /* Estimate the amount of available space in the request. */ - bufcount = req_capsule_filled_sizes(pill, RCL_CLIENT); + req_capsule_filled_sizes(pill, RCL_CLIENT); avail = ldlm_capsule_handles_avail(pill, RCL_CLIENT, canceloff); flags = ns_connect_lru_resize(ns) ? @@ -1119,8 +1119,6 @@ int ldlm_cli_cancel_req(struct obd_export *exp, cfs_list_t *cancels, count = free; while (1) { - int bufcount; - imp = class_exp2cliimp(exp); if (imp == NULL || imp->imp_invalid) { CDEBUG(D_DLMTRACE, @@ -1132,7 +1130,7 @@ int ldlm_cli_cancel_req(struct obd_export *exp, cfs_list_t *cancels, if (req == NULL) GOTO(out, rc = -ENOMEM); - bufcount = req_capsule_filled_sizes(&req->rq_pill, RCL_CLIENT); + req_capsule_filled_sizes(&req->rq_pill, RCL_CLIENT); req_capsule_set_size(&req->rq_pill, &RMF_DLM_REQ, RCL_CLIENT, ldlm_request_bufsize(count, LDLM_CANCEL)); @@ -1195,7 +1193,7 @@ static inline struct ldlm_pool *ldlm_imp2pl(struct obd_import *imp) int ldlm_cli_update_pool(struct ptlrpc_request *req) { struct obd_device *obd; - __u64 old_slv, new_slv; + __u64 new_slv; __u32 new_limit; ENTRY; if (unlikely(!req->rq_import || !req->rq_import->imp_obd || @@ -1235,7 +1233,6 @@ int ldlm_cli_update_pool(struct ptlrpc_request *req) * oops in that time. */ cfs_write_lock(&obd->obd_pool_lock); - old_slv = obd->obd_pool_slv; obd->obd_pool_slv = new_slv; obd->obd_pool_limit = new_limit; cfs_write_unlock(&obd->obd_pool_lock); diff --git a/lustre/liblustre/dir.c b/lustre/liblustre/dir.c index 92414ab..846e228 100644 --- a/lustre/liblustre/dir.c +++ b/lustre/liblustre/dir.c @@ -200,7 +200,6 @@ ssize_t llu_iop_filldirentries(struct inode *dir, _SYSIO_OFF_T *basep, int filled = 0; int rc; int done; - int shift; __u16 type; ENTRY; @@ -219,7 +218,6 @@ ssize_t llu_iop_filldirentries(struct inode *dir, _SYSIO_OFF_T *basep, rc = 0; done = 0; - shift = 0; ll_dir_chain_init(&chain); page = llu_dir_read_page(dir, pos, 0, &chain); diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index aa56124..29d8247 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -189,7 +189,6 @@ int llu_iop_open(struct pnode *pnode, int flags, mode_t mode) struct inode *inode = pnode->p_base->pb_ino; struct llu_inode_info *lli = llu_i2info(inode); struct intnl_stat *st = llu_i2stat(inode); - struct ll_file_data *fd; struct ptlrpc_request *request; struct lookup_intent *it; struct lov_stripe_md *lsm; @@ -220,8 +219,6 @@ int llu_iop_open(struct pnode *pnode, int flags, mode_t mode) if (!S_ISREG(st->st_mode)) GOTO(out_release, rc = 0); - fd = lli->lli_file_data; - lsm = lli->lli_smd; if (lsm) flags &= ~O_LOV_DELAY_CREATE; diff --git a/lustre/liblustre/llite_cl.c b/lustre/liblustre/llite_cl.c index ed8c988..d553284 100644 --- a/lustre/liblustre/llite_cl.c +++ b/lustre/liblustre/llite_cl.c @@ -488,7 +488,6 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io, struct obd_export *exp = llu_i2obdexp(inode); struct page *page; int rc = 0, ret_bytes = 0; - int local_lock; struct cl_page *clp; struct cl_2queue *queue; ENTRY; @@ -496,8 +495,6 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io, if (!exp) RETURN(-EINVAL); - local_lock = group->lig_params->lrp_lock_mode != LCK_NL; - queue = &io->ci_queue; cl_2queue_init(queue); diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 797e911..4805180 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -208,7 +208,6 @@ static int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it) { struct pnode_base *pb = pnode->p_base; - struct it_cb_data icbd; struct md_op_data op_data = {{ 0 }}; struct ptlrpc_request *req = NULL; struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; @@ -245,8 +244,6 @@ static int llu_pb_revalidate(struct pnode *pnode, int flags, } exp = llu_i2mdexp(pb->pb_ino); - icbd.icbd_parent = pnode->p_parent->p_base->pb_ino; - icbd.icbd_child = pnode; if (!it) { it = &lookup_it; diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 42c1bd4..0846247 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -486,6 +486,7 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, if (*och_p) { /* Everything is open already, do nothing */ /*(*och_usecount)++; Do not let them steal our open handle from under us */ + SET_BUT_UNUSED(och_usecount); /* XXX The code above was my original idea, but in case we have the handle, but we cannot use it due to later checks (e.g. O_CREAT|O_EXCL flags set), nobody diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index ecb7571..b6c9b2f 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -513,7 +513,6 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) struct page *page; struct ll_dir_chain chain; int done; - int shift; int rc; ENTRY; @@ -529,7 +528,6 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) rc = 0; done = 0; - shift = 0; ll_dir_chain_init(&chain); fd->fd_dir.lfd_next = pos; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index d8ba5c9..78eb805 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1883,10 +1883,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin) ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1); if (origin == 2) { /* SEEK_END */ - int nonblock = 0, rc; - - if (file->f_flags & O_NONBLOCK) - nonblock = LDLM_FL_BLOCK_NOWAIT; + int rc; rc = cl_glimpse_size(inode); if (rc != 0) @@ -2230,7 +2227,6 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, { struct inode *inode = dentry->d_inode; struct ptlrpc_request *req = NULL; - struct ll_sb_info *sbi; struct obd_export *exp; int rc = 0; ENTRY; @@ -2239,7 +2235,6 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, CERROR("REPORT THIS LINE TO PETER\n"); RETURN(0); } - sbi = ll_i2sbi(inode); CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n", inode->i_ino, inode->i_generation, inode, dentry->d_name.name); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index a3274ec..e24aa81 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1324,7 +1324,7 @@ struct ll_dio_pages { static inline void cl_stats_tally(struct cl_device *dev, enum cl_req_type crt, int rc) { - int opc = (crt == CIT_READ) ? LPROC_LL_OSC_READ : + int opc = (crt == CRT_READ) ? LPROC_LL_OSC_READ : LPROC_LL_OSC_WRITE; ll_stats_ops_tally(ll_s2sbi(cl2ccc_dev(dev)->cdv_sb), opc, rc); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 2243aab..b8849a5 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -148,7 +148,6 @@ static struct ll_cl_context *ll_cl_init(struct file *file, cio = ccc_env_io(env); io = cio->cui_cl.cis_io; if (io == NULL && create) { - struct vvp_io *vio; loff_t pos; /* @@ -156,9 +155,7 @@ static struct ll_cl_context *ll_cl_init(struct file *file, * methods directly, bypassing file system ->write() operation, * so cl_io has to be created here. */ - io = ccc_env_thread_io(env); - vio = vvp_env_io(env); ll_io_init(io, file, 1); /* No lock at all for this kind of IO - we can't do it because diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 3e765ba..88ffcc1 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2073,7 +2073,6 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *src_tgt; - struct lmv_tgt_desc *tgt_tgt; int rc; int sidx; int loop = 0; @@ -2133,7 +2132,6 @@ repeat: op_data->op_cap = cfs_curproc_cap_pack(); src_tgt = lmv_get_target(lmv, mds1); - tgt_tgt = lmv_get_target(lmv, mds2); /* * LOOKUP lock on src child (fid3) should also be cancelled for @@ -2534,6 +2532,8 @@ repeat: first->ldp_hash_end = hash_end; first->ldp_flags &= ~cpu_to_le32(LDF_COLLIDE); first->ldp_flags |= flags & cpu_to_le32(LDF_COLLIDE); +#else + SET_BUT_UNUSED(tmp); #endif cfs_kunmap(pages[i]); } diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 9180373..f454a59 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -790,7 +790,6 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, int stripe_cnt_min = min_stripe_count(*stripe_cnt, flags); struct pool_desc *pool; struct ost_pool *osts; - struct lov_qos_rr *lqr; ENTRY; if (stripe_cnt_min < 1) @@ -799,11 +798,9 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, pool = lov_find_pool(lov, poolname); if (pool == NULL) { osts = &(lov->lov_packed); - lqr = &(lov->lov_qos.lq_rr); } else { cfs_down_read(&pool_tgt_rw_sem(pool)); osts = &(pool->pool_obds); - lqr = &(pool->pool_rr); } obd_getref(exp->exp_obd); diff --git a/lustre/lov/lovsub_lock.c b/lustre/lov/lovsub_lock.c index 4810da4..263adff 100644 --- a/lustre/lov/lovsub_lock.c +++ b/lustre/lov/lovsub_lock.c @@ -205,7 +205,6 @@ int lov_sublock_modify(const struct lu_env *env, struct lov_lock *lov, const struct cl_lock_descr *d, int idx) { struct cl_lock *parent; - struct cl_lock *child; struct lovsub_object *subobj; struct cl_lock_descr *pd; struct cl_lock_descr *parent_descr; @@ -215,7 +214,6 @@ int lov_sublock_modify(const struct lu_env *env, struct lov_lock *lov, parent_descr = &parent->cll_descr; LASSERT(cl_lock_mode_match(d->cld_mode, parent_descr->cld_mode)); - child = sublock->lss_cl.cls_lock; subobj = cl2lovsub(sublock->lss_cl.cls_obj); pd = &lov_env_info(env)->lti_ldescr; diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index 4269afe..af03ac7 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -388,13 +388,8 @@ struct l_file *l_dentry_open(struct lvfs_run_ctxt *ctxt, struct l_dentry *de, } EXPORT_SYMBOL(l_dentry_open); -#ifdef HAVE_VFS_READDIR_U64_INO static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type) -#else -static int l_filldir(void *__buf, const char *name, int namlen, loff_t offset, - ino_t ino, unsigned int d_type) -#endif { struct l_linux_dirent *dirent; struct l_readdir_callback *buf = (struct l_readdir_callback *)__buf; diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 4fc9f6b..99c9c0c 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -633,7 +633,6 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, { struct obd_device *obddev = class_exp2obd(exp); struct ptlrpc_request *req = NULL; - struct req_capsule *pill; int flags = extra_lock_flags; int rc; struct ldlm_res_id res_id; @@ -684,7 +683,6 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, if (IS_ERR(req)) RETURN(PTR_ERR(req)); - pill = &req->rq_pill; /* It is important to obtain rpc_lock first (if applicable), so that * threads that are serialised with rpc_lock are not polluting our diff --git a/lustre/obdclass/cl_lock.c b/lustre/obdclass/cl_lock.c index 5aceee0..b8096b7 100644 --- a/lustre/obdclass/cl_lock.c +++ b/lustre/obdclass/cl_lock.c @@ -298,14 +298,12 @@ static void cl_lock_free(const struct lu_env *env, struct cl_lock *lock) void cl_lock_put(const struct lu_env *env, struct cl_lock *lock) { struct cl_object *obj; - struct cl_object_header *head; struct cl_site *site; LINVRNT(cl_lock_invariant(env, lock)); ENTRY; obj = lock->cll_descr.cld_obj; LINVRNT(obj != NULL); - head = cl_object_header(obj); site = cl_object_site(obj); CDEBUG(D_TRACE, "releasing reference: %d %p %lu\n", diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 27fc136..4c82107 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2296,10 +2296,8 @@ static struct ptlrpc_request *osc_build_req(const struct lu_env *env, struct osc_brw_async_args *aa; struct obdo *oa = NULL; const struct obd_async_page_ops *ops = NULL; - void *caller_data = NULL; struct osc_async_page *oap; struct osc_async_page *tmp; - struct ost_body *body; struct cl_req *clerq = NULL; enum cl_req_type crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE : CRT_READ; struct ldlm_lock *lock = NULL; @@ -2326,7 +2324,6 @@ static struct ptlrpc_request *osc_build_req(const struct lu_env *env, struct cl_page *page = osc_oap2cl_page(oap); if (ops == NULL) { ops = oap->oap_caller_ops; - caller_data = oap->oap_caller_data; clerq = cl_req_alloc(env, page, crt, 1 /* only 1-object rpcs for @@ -2375,7 +2372,6 @@ static struct ptlrpc_request *osc_build_req(const struct lu_env *env, * later setattr before earlier BRW (as determined by the request xid), * the OST will not use BRW timestamps. Sadly, there is no obvious * way to do this in a single call. bug 10150 */ - body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY); cl_req_attr_set(env, clerq, &crattr, OBD_MD_FLMTIME|OBD_MD_FLCTIME|OBD_MD_FLATIME); diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index 3929127..e673548 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -127,7 +127,6 @@ int llog_origin_handle_destroy(struct ptlrpc_request *req) struct lvfs_run_ctxt saved; struct llog_logid *logid = NULL; struct llog_ctxt *ctxt; - __u32 flags; int rc; ENTRY; @@ -155,7 +154,6 @@ int llog_origin_handle_destroy(struct ptlrpc_request *req) body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; - flags = body->lgd_llh_flags; rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index b95f8ca..d91ac57 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -163,9 +163,7 @@ cfs_duration_t pinger_check_timeout(cfs_time_t time) cfs_time_current()); } -#ifdef __KERNEL__ static cfs_waitq_t suspend_timeouts_waitq; -#endif cfs_time_t ptlrpc_suspend_wakeup_time(void) { diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index e4c5e73..0616c04a 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -700,6 +700,8 @@ out: if (env != 0) lu_context_fini(&pc->pc_env.le_ctx); cfs_clear_bit(LIOD_BIND, &pc->pc_flags); +#else + SET_BUT_UNUSED(env); #endif cfs_clear_bit(LIOD_START, &pc->pc_flags); } diff --git a/lustre/ptlrpc/sec_config.c b/lustre/ptlrpc/sec_config.c index 5af3690..2e4791f 100644 --- a/lustre/ptlrpc/sec_config.c +++ b/lustre/ptlrpc/sec_config.c @@ -795,14 +795,13 @@ EXPORT_SYMBOL(sptlrpc_conf_log_update_end); void sptlrpc_conf_log_start(const char *logname) { - struct sptlrpc_conf *conf; char fsname[16]; if (logname2fsname(logname, fsname, sizeof(fsname))) return; cfs_mutex_lock(&sptlrpc_conf_lock); - conf = sptlrpc_conf_get(fsname, 1); + sptlrpc_conf_get(fsname, 1); cfs_mutex_unlock(&sptlrpc_conf_lock); } EXPORT_SYMBOL(sptlrpc_conf_log_start); diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index b0b9035..283c489 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -351,8 +351,8 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc) { - struct ptlrpc_bulk_sec_desc *bsdr, *bsdv; - struct plain_bulk_token *tokenr, *tokenv; + struct ptlrpc_bulk_sec_desc *bsdv; + struct plain_bulk_token *tokenv; int rc; #ifdef __KERNEL__ int i, nob; @@ -362,8 +362,6 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS); LASSERT(req->rq_repdata->lm_bufcount == PLAIN_PACK_SEGMENTS); - bsdr = lustre_msg_buf(req->rq_reqbuf, PLAIN_PACK_BULK_OFF, 0); - tokenr = (struct plain_bulk_token *) bsdr->bsd_data; bsdv = lustre_msg_buf(req->rq_repdata, PLAIN_PACK_BULK_OFF, 0); tokenv = (struct plain_bulk_token *) bsdv->bsd_data; @@ -911,7 +909,7 @@ int plain_svc_unwrap_bulk(struct ptlrpc_request *req, { struct ptlrpc_reply_state *rs = req->rq_reply_state; struct ptlrpc_bulk_sec_desc *bsdr, *bsdv; - struct plain_bulk_token *tokenr, *tokenv; + struct plain_bulk_token *tokenr; int rc; LASSERT(req->rq_bulk_write); @@ -920,7 +918,6 @@ int plain_svc_unwrap_bulk(struct ptlrpc_request *req, bsdr = lustre_msg_buf(req->rq_reqbuf, PLAIN_PACK_BULK_OFF, 0); tokenr = (struct plain_bulk_token *) bsdr->bsd_data; bsdv = lustre_msg_buf(rs->rs_repbuf, PLAIN_PACK_BULK_OFF, 0); - tokenv = (struct plain_bulk_token *) bsdv->bsd_data; bsdv->bsd_version = 0; bsdv->bsd_type = SPTLRPC_BULK_DEFAULT; @@ -946,14 +943,13 @@ int plain_svc_wrap_bulk(struct ptlrpc_request *req, { struct ptlrpc_reply_state *rs = req->rq_reply_state; struct ptlrpc_bulk_sec_desc *bsdr, *bsdv; - struct plain_bulk_token *tokenr, *tokenv; + struct plain_bulk_token *tokenv; int rc; LASSERT(req->rq_bulk_read); LASSERT(req->rq_pack_bulk); bsdr = lustre_msg_buf(req->rq_reqbuf, PLAIN_PACK_BULK_OFF, 0); - tokenr = (struct plain_bulk_token *) bsdr->bsd_data; bsdv = lustre_msg_buf(rs->rs_repbuf, PLAIN_PACK_BULK_OFF, 0); tokenv = (struct plain_bulk_token *) bsdv->bsd_data; diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index b4b036f..a36bc28 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1595,7 +1595,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, struct timeval work_start; struct timeval work_end; long timediff; - int opc, rc; + int rc; int fail_opc = 0; ENTRY; @@ -1615,7 +1615,6 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, RETURN(0); } - opc = lustre_msg_get_opc(request->rq_reqmsg); if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT)) fail_opc = OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT; else if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_TIMEOUT)) @@ -1787,13 +1786,11 @@ ptlrpc_handle_rs (struct ptlrpc_reply_state *rs) { struct ptlrpc_service *svc = rs->rs_service; struct obd_export *exp; - struct obd_device *obd; int nlocks; int been_handled; ENTRY; exp = rs->rs_export; - obd = exp->exp_obd; LASSERT (rs->rs_difficult); LASSERT (rs->rs_scheduled); diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index 828a7c1..df99540 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -181,12 +181,9 @@ int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count, struct obd_device *obd = (struct obd_device *)data; char stype[MAX_STYPE_SIZE + 1] = ""; int oq_type; - struct obd_device_target *obt; LASSERT(obd != NULL); - obt = &obd->u.obt; - /* Collect the needed information */ oq_type = obd->u.obt.obt_qctxt.lqc_flags; @@ -291,17 +288,12 @@ int lprocfs_quota_wr_type(struct file *file, const char *buffer, unsigned long count, void *data) { struct obd_device *obd = (struct obd_device *)data; - struct obd_device_target *obt; - int type = 0, is_mds; + int type = 0; unsigned long i; char stype[MAX_STYPE_SIZE + 1] = ""; LASSERT(obd != NULL); - obt = &obd->u.obt; - - is_mds = !strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME); - if (count > MAX_STYPE_SIZE) return -EINVAL; diff --git a/lustre/tests/writeme.c b/lustre/tests/writeme.c index 837552d..577fcfe 100644 --- a/lustre/tests/writeme.c +++ b/lustre/tests/writeme.c @@ -48,9 +48,8 @@ void usage(char *prog) int main(int argc, char **argv) { int fd, rc; - int do_sync = 0; - int i = 0; - int file_arg = 1; + int do_sync = 0; + int file_arg = 1; char buf[4096]; memset(buf, 0, 4096); @@ -71,8 +70,8 @@ int main(int argc, char **argv) exit(1); } - while (1) { - sprintf(buf, "write %d\n", i); + for (rc = 0; ;) { + sprintf(buf, "write %d\n", rc); rc = write(fd, buf, sizeof(buf)); if (do_sync) sync(); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 999a2c3..88a0cd2 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2538,7 +2538,6 @@ int llapi_target_iterate(int type_num, char **obd_type, char *obd_name = NULL; char *obd_uuid = NULL; char *bufp = buf; - struct obd_ioctl_data datal = { 0, }; struct obd_statfs osfs_buffer; while(bufp[0] == ' ') @@ -2552,9 +2551,6 @@ int llapi_target_iterate(int type_num, char **obd_type, memset(&osfs_buffer, 0, sizeof (osfs_buffer)); - datal.ioc_pbuf1 = (char *)&osfs_buffer; - datal.ioc_plen1 = sizeof(osfs_buffer); - for (i = 0; i < type_num; i++) { if (strcmp(obd_type_name, obd_type[i]) != 0) continue; diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index ac14f25..a394a4c 100644 --- a/lustre/utils/ll_decode_filter_fid.c +++ b/lustre/utils/ll_decode_filter_fid.c @@ -51,12 +51,9 @@ int main(int argc, char *argv[]) { - char *prog; int rc = 0; int i; - prog = basename(argv[0]); - for (i = 1; i < argc; i++) { char buf[1024]; /* allow xattr that may be larger */ struct filter_fid *ff = (void *)buf;