From: Dmitry Eremin Date: Wed, 24 Apr 2013 13:25:14 +0000 (+0400) Subject: LU-3204 build: clean up unused variables and dead code X-Git-Tag: 2.4.53~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=da09be15c52c15ab42aec658c848fa17453855a2 LU-3204 build: clean up unused variables and dead code Clean up the code from really unused variables and rearrange other to remove SET_BUT_UNUSED and UNUSED macro usage if possible. Clean up or comment on some dead code. Removed never implemented suspend timeouts functionality from pinger.c which was commented out since 2007 and going to be replaced by adaptive timeouts. Also removed all references to this functionality from ldlm_lockd.c, ldlm_request.c and import.c which actually nevers executes or do nothing. pinger.c commit d2d56f38da01001c92a09afc6b52b5acbd9bc13c Author: tappro Date: Mon Jul 30 21:08:59 2007 +0000 - make HEAD from b_post_cmd3 Signed-off-by: Dmitry Eremin Signed-off-by: Ned Bass Change-Id: If7b6b3576d3ecc79948a7a1eb46a08c27a3bbc03 Reviewed-on: http://review.whamcloud.com/6139 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index c44b8a7..76abc5a 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -291,8 +291,6 @@ 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/libcfs/workitem.c b/libcfs/libcfs/workitem.c index 309cfec..5b66e60 100644 --- a/libcfs/libcfs/workitem.c +++ b/libcfs/libcfs/workitem.c @@ -377,8 +377,6 @@ cfs_wi_check_events (void) void cfs_wi_sched_destroy(struct cfs_wi_sched *sched) { - int i; - LASSERT(cfs_wi_data.wi_init); LASSERT(!cfs_wi_data.wi_stopping); @@ -395,26 +393,28 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_unlock(&cfs_wi_data.wi_glock); - i = 2; #ifdef __KERNEL__ cfs_waitq_broadcast(&sched->ws_waitq); spin_lock(&cfs_wi_data.wi_glock); - while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, - "waiting for %d threads of WI sched[%s] to terminate\n", - sched->ws_nthreads, sched->ws_name); + { + int i = 2; - spin_unlock(&cfs_wi_data.wi_glock); - cfs_pause(cfs_time_seconds(1) / 20); - spin_lock(&cfs_wi_data.wi_glock); + while (sched->ws_nthreads > 0) { + CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + "waiting for %d threads of WI sched[%s] to " + "terminate\n", sched->ws_nthreads, + sched->ws_name); + + spin_unlock(&cfs_wi_data.wi_glock); + cfs_pause(cfs_time_seconds(1) / 20); + spin_lock(&cfs_wi_data.wi_glock); + } } cfs_list_del(&sched->ws_list); spin_unlock(&cfs_wi_data.wi_glock); -#else - SET_BUT_UNUSED(i); #endif LASSERT(sched->ws_nscheduled == 0); @@ -427,7 +427,6 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, int cpt, int nthrs, struct cfs_wi_sched **sched_pp) { struct cfs_wi_sched *sched; - int rc; LASSERT(cfs_wi_data.wi_init); LASSERT(!cfs_wi_data.wi_stopping); @@ -450,11 +449,11 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, CFS_INIT_LIST_HEAD(&sched->ws_rerunq); CFS_INIT_LIST_HEAD(&sched->ws_list); - rc = 0; #ifdef __KERNEL__ - while (nthrs > 0) { - char name[16]; + for (; nthrs > 0; nthrs--) { + char name[16]; cfs_task_t *task; + spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_starting > 0) { spin_unlock(&cfs_wi_data.wi_glock); @@ -475,28 +474,24 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, } task = kthread_run(cfs_wi_scheduler, sched, name); - if (!IS_ERR(task)) { - nthrs--; - continue; - } - rc = PTR_ERR(task); + if (IS_ERR(task)) { + int rc = PTR_ERR(task); - CERROR("Failed to create thread for WI scheduler %s: %d\n", - name, rc); + CERROR("Failed to create thread for " + "WI scheduler %s: %d\n", name, rc); - spin_lock(&cfs_wi_data.wi_glock); + spin_lock(&cfs_wi_data.wi_glock); - /* make up for cfs_wi_sched_destroy */ - cfs_list_add(&sched->ws_list, &cfs_wi_data.wi_scheds); - sched->ws_starting--; + /* make up for cfs_wi_sched_destroy */ + cfs_list_add(&sched->ws_list, &cfs_wi_data.wi_scheds); + sched->ws_starting--; - spin_unlock(&cfs_wi_data.wi_glock); + spin_unlock(&cfs_wi_data.wi_glock); - cfs_wi_sched_destroy(sched); - return rc; + cfs_wi_sched_destroy(sched); + return rc; + } } -#else - SET_BUT_UNUSED(rc); #endif spin_lock(&cfs_wi_data.wi_glock); cfs_list_add(&sched->ws_list, &cfs_wi_data.wi_scheds); diff --git a/libsysio/src/access.c b/libsysio/src/access.c index 784de8e..1281541 100644 --- a/libsysio/src/access.c +++ b/libsysio/src/access.c @@ -218,13 +218,6 @@ _sysio_ldcreds(uid_t uid, gid_t gid, struct creds *crp) return 0; } -static int -_sysio_getcreds(struct creds *crp) -{ - - return _sysio_ldcreds(getuid(), getgid(), crp); -} - /* * Determine if a given access is permitted to a given file. */ diff --git a/libsysio/src/file_hack.c b/libsysio/src/file_hack.c index 2eb6105..e2eb79d 100644 --- a/libsysio/src/file_hack.c +++ b/libsysio/src/file_hack.c @@ -282,7 +282,7 @@ _sysio_fd_close(int fd) { struct file *fil; - fil = fil = __sysio_fd_get(fd, 1); + fil = __sysio_fd_get(fd, 1); if (!fil) return -EBADF; @@ -399,23 +399,19 @@ _sysio_oftable_close_all(oftab_t *oftab) int _sysio_fd_close_all() { - int fd; - struct file **filp; - oftab_t *oftab; - int i; - - /* - * Close all open descriptors. - */ + /* Close all open descriptors */ _sysio_oftable_close_all(&_sysio_oftab[OFTAB_VIRTUAL]); - /* XXX see liblustre/llite_lib.c for explaination */ + /* FIXME: libsysio does not currently perform enough cleanup of + * open files to allow __liblustre_cleanup_() to safely call + * unmount(). See the related FIXME comment in that function + * for details. The following disabled code is left in place to + * document the solution that was originally under consideration + * but never fully implemented. */ #if 0 _sysio_oftable_close_all(&_sysio_oftab[OFTAB_NATIVE]); #endif - /* - * Release current working directory. - */ + /* Release current working directory */ if (_sysio_cwd) { P_RELE(_sysio_cwd); _sysio_cwd = NULL; diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 1df7cca..97bb5e7 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -125,34 +125,16 @@ lnet_get_networks (void) { static char default_networks[256]; char *networks = getenv ("LNET_NETWORKS"); - char *ip2nets = getenv ("LNET_IP2NETS"); char *str; char *sep; int len; int nob; - int rc; cfs_list_t *tmp; -#ifdef NOT_YET - if (networks != NULL && ip2nets != NULL) { - LCONSOLE_ERROR_MSG(0x103, "Please set EITHER 'LNET_NETWORKS' or" - " 'LNET_IP2NETS' but not both at once\n"); - return NULL; - } - - if (ip2nets != NULL) { - rc = lnet_parse_ip2nets(&networks, ip2nets); - return (rc == 0) ? networks : NULL; - } -#else - SET_BUT_UNUSED(ip2nets); - SET_BUT_UNUSED(rc); -#endif if (networks != NULL) return networks; /* In userland, the default 'networks=' is the list of known net types */ - len = sizeof(default_networks); str = default_networks; *str = 0; @@ -163,13 +145,12 @@ lnet_get_networks (void) nob = snprintf(str, len, "%s%s", sep, libcfs_lnd2str(lnd->lnd_type)); + if (nob >= len) { + /* overflowed the string; leave it where it was */ + *str = 0; + break; + } len -= nob; - if (len < 0) { - /* overflowed the string; leave it where it was */ - *str = 0; - break; - } - str += nob; sep = ","; } diff --git a/lnet/selftest/rpc.c b/lnet/selftest/rpc.c index 301a31a..60fb45a 100644 --- a/lnet/selftest/rpc.c +++ b/lnet/selftest/rpc.c @@ -142,7 +142,6 @@ srpc_bulk_t * srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) { srpc_bulk_t *bk; - struct page **pages; int i; LASSERT(bulk_npg > 0 && bulk_npg <= LNET_MAX_IOV); @@ -159,18 +158,22 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) bk->bk_len = bulk_len; bk->bk_niov = bulk_npg; #ifndef __KERNEL__ - LIBCFS_CPT_ALLOC(pages, lnet_cpt_table(), cpt, - sizeof(struct page *) * bulk_npg); - if (pages == NULL) { - LIBCFS_FREE(bk, offsetof(srpc_bulk_t, bk_iovs[bulk_npg])); - CERROR("Can't allocate page array for %d pages\n", bulk_npg); - return NULL; - } + { + struct page **pages; + + LIBCFS_CPT_ALLOC(pages, lnet_cpt_table(), cpt, + sizeof(struct page *) * bulk_npg); + if (pages == NULL) { + LIBCFS_FREE(bk, offsetof(srpc_bulk_t, + bk_iovs[bulk_npg])); + CERROR("Can't allocate page array for %d pages\n", + bulk_npg); + return NULL; + } - memset(pages, 0, sizeof(struct page *) * bulk_npg); - bk->bk_pages = pages; -#else - UNUSED(pages); + memset(pages, 0, sizeof(struct page *) * bulk_npg); + bk->bk_pages = pages; + } #endif for (i = 0; i < bulk_npg; i++) { diff --git a/lnet/selftest/selftest.h b/lnet/selftest/selftest.h index 3fa44f4..d1ecabd 100644 --- a/lnet/selftest/selftest.h +++ b/lnet/selftest/selftest.h @@ -595,8 +595,6 @@ swi_state2str (int state) #undef STATE2STR } -#define UNUSED(x) ( (void)(x) ) - #ifndef __KERNEL__ int stt_poll_interval(void); diff --git a/lnet/selftest/timer.c b/lnet/selftest/timer.c index f2f8262..e98dbbf 100644 --- a/lnet/selftest/timer.c +++ b/lnet/selftest/timer.c @@ -179,9 +179,6 @@ int stt_timer_main (void *arg) { int rc = 0; - UNUSED(arg); - - SET_BUT_UNUSED(rc); cfs_block_allsigs(); @@ -192,12 +189,13 @@ stt_timer_main (void *arg) stt_data.stt_shuttingdown, cfs_time_seconds(STTIMER_SLOTTIME), rc); + rc = 0; /* Discard jiffies remaining before timeout. */ } spin_lock(&stt_data.stt_lock); stt_data.stt_nthreads--; spin_unlock(&stt_data.stt_lock); - return 0; + return rc; } int diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index cd3e386..b9118c7 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -422,13 +422,15 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \ hlist_for_each_entry(dentry, p, i_dentry, alias) #endif +#define DECLARE_LL_D_HLIST_NODE_PTR(name) struct ll_d_hlist_node *name #else #define ll_d_hlist_node list_head #define ll_d_hlist_empty(list) list_empty(list) #define ll_d_hlist_entry(ptr, type, name) list_entry(ptr.next, type, name) #define ll_d_hlist_for_each(tmp, i_dentry) list_for_each(tmp, i_dentry) #define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \ - p = NULL; list_for_each_entry(dentry, i_dentry, alias) + list_for_each_entry(dentry, i_dentry, alias) +#define DECLARE_LL_D_HLIST_NODE_PTR(name) /* nothing */ #endif diff --git a/lustre/include/lustre_ha.h b/lustre/include/lustre_ha.h index 105f6d6..f3ae02b 100644 --- a/lustre/include/lustre_ha.h +++ b/lustre/include/lustre_ha.h @@ -58,9 +58,6 @@ void ptlrpc_activate_import(struct obd_import *imp); void ptlrpc_deactivate_import(struct obd_import *imp); void ptlrpc_invalidate_import(struct obd_import *imp); void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt); -int ptlrpc_check_suspend(void); -void ptlrpc_activate_timeouts(struct obd_import *imp); -void ptlrpc_deactivate_timeouts(struct obd_import *imp); /** @} ha */ diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 94072c0..c481674 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -790,6 +790,7 @@ do { \ } while (0) #else /* !__KERNEL__ */ + #define __l_wait_event(wq, condition, info, ret, l_add_wait) \ do { \ long __timeout = info->lwi_timeout; \ @@ -832,7 +833,6 @@ do { \ } \ } \ } \ - SET_BUT_UNUSED(wq); \ } while (0) #endif /* __KERNEL__ */ diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 2ef7b9e..d5a9731 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -3465,7 +3465,6 @@ int ptlrpc_del_timeout_client(cfs_list_t *obd_list, enum timeout_event event); struct ptlrpc_request * ptlrpc_prep_ping(struct obd_import *imp); int ptlrpc_obd_ping(struct obd_device *obd); -cfs_time_t ptlrpc_suspend_wakeup_time(void); #ifdef __KERNEL__ void ping_evictor_start(void); void ping_evictor_stop(void); @@ -3473,7 +3472,6 @@ void ping_evictor_stop(void); #define ping_evictor_start() do {} while (0) #define ping_evictor_stop() do {} while (0) #endif -int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req); void ptlrpc_pinger_ir_up(void); void ptlrpc_pinger_ir_down(void); /** @} */ diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 1cfd813..b98c76f 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -312,53 +312,6 @@ static void waiting_locks_callback(unsigned long unused) (lock->l_req_mode == LCK_GROUP)) break; - if (ptlrpc_check_suspend()) { - /* there is a case when we talk to one mds, holding - * lock from another mds. this way we easily can get - * here, if second mds is being recovered. so, we - * suspend timeouts. bug 6019 */ - - LDLM_ERROR(lock, "recharge timeout: %s@%s nid %s ", - lock->l_export->exp_client_uuid.uuid, - lock->l_export->exp_connection->c_remote_uuid.uuid, - libcfs_nid2str(lock->l_export->exp_connection->c_peer.nid)); - - cfs_list_del_init(&lock->l_pending_chain); - if (lock->l_flags & LDLM_FL_DESTROYED) { - /* relay the lock refcount decrease to - * expired lock thread */ - cfs_list_add(&lock->l_pending_chain, - &expired_lock_thread.elt_expired_locks); - } else { - __ldlm_add_waiting_lock(lock, - ldlm_get_enq_timeout(lock)); - } - continue; - } - - /* if timeout overlaps the activation time of suspended timeouts - * then extend it to give a chance for client to reconnect */ - if (cfs_time_before(cfs_time_sub(lock->l_callback_timeout, - cfs_time_seconds(obd_timeout)/2), - ptlrpc_suspend_wakeup_time())) { - LDLM_ERROR(lock, "extend timeout due to recovery: %s@%s nid %s ", - lock->l_export->exp_client_uuid.uuid, - lock->l_export->exp_connection->c_remote_uuid.uuid, - libcfs_nid2str(lock->l_export->exp_connection->c_peer.nid)); - - cfs_list_del_init(&lock->l_pending_chain); - if (lock->l_flags & LDLM_FL_DESTROYED) { - /* relay the lock refcount decrease to - * expired lock thread */ - cfs_list_add(&lock->l_pending_chain, - &expired_lock_thread.elt_expired_locks); - } else { - __ldlm_add_waiting_lock(lock, - ldlm_get_enq_timeout(lock)); - } - continue; - } - /* Check if we need to prolong timeout */ if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_TIMEOUT) && ldlm_lock_busy(lock)) { diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 95b2f63..49af914 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -102,9 +102,6 @@ int ldlm_expired_completion_wait(void *data) if (lock->l_conn_export == NULL) { static cfs_time_t next_dump = 0, last_dump = 0; - if (ptlrpc_check_suspend()) - RETURN(0); - LCONSOLE_WARN("lock timed out (enqueued at "CFS_TIME_T", " CFS_DURATION_T"s ago)\n", lock->l_last_activity, diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 9f57ed8..3a85a13 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -307,7 +307,7 @@ void ll_intent_release(struct lookup_intent *it) void ll_invalidate_aliases(struct inode *inode) { struct dentry *dentry; - struct ll_d_hlist_node *p; + DECLARE_LL_D_HLIST_NODE_PTR(p); ENTRY; LASSERT(inode != NULL); @@ -446,7 +446,6 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, struct inode *inode = de->d_inode; struct ll_inode_info *lli = ll_i2info(inode); struct obd_client_handle **och_p; - __u64 *och_usecount; __u64 ibits; /* @@ -459,39 +458,31 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, * change, LOOKUP lock is revoked. */ - - if (it->it_flags & FMODE_WRITE) { - och_p = &lli->lli_mds_write_och; - och_usecount = &lli->lli_open_fd_write_count; - } else if (it->it_flags & FMODE_EXEC) { - och_p = &lli->lli_mds_exec_och; - och_usecount = &lli->lli_open_fd_exec_count; - } else { - och_p = &lli->lli_mds_read_och; - och_usecount = &lli->lli_open_fd_read_count; - } + if (it->it_flags & FMODE_WRITE) + och_p = &lli->lli_mds_write_och; + else if (it->it_flags & FMODE_EXEC) + och_p = &lli->lli_mds_exec_och; + else + och_p = &lli->lli_mds_read_och; /* Check for the proper lock. */ ibits = MDS_INODELOCK_LOOKUP; if (!ll_have_md_lock(inode, &ibits, LCK_MINMODE)) goto do_lock; mutex_lock(&lli->lli_och_mutex); - 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 - would decrement counter increased here. So we just - hope the lock won't be invalidated in between. But - if it would be, we'll reopen the open request to - MDS later during file open path */ - mutex_unlock(&lli->lli_och_mutex); - RETURN(1); - } else { + if (*och_p) { /* Everything is open already, do nothing */ + /* Originally it was idea to do not let them steal our + * open handle from under us by (*och_usecount)++ here. + * 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 would decrement counter increased here. So we + * just hope the lock won't be invalidated in between. + * But if it would be, we'll reopen the open request to + * MDS later during file open path. */ mutex_unlock(&lli->lli_och_mutex); - } - } + RETURN(1); + } + mutex_unlock(&lli->lli_och_mutex); + } if (it->it_op == IT_GETATTR) { rc = ll_statahead_enter(parent, &de, 0); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 857c4508..0db1ee0 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -175,7 +175,7 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, static void ll_invalidate_negative_children(struct inode *dir) { struct dentry *dentry, *tmp_subdir; - struct ll_d_hlist_node *p; + DECLARE_LL_D_HLIST_NODE_PTR(p); ll_lock_dcache(dir); ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) { @@ -356,7 +356,7 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2) static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) { struct dentry *alias, *discon_alias, *invalid_alias; - struct ll_d_hlist_node *p; + DECLARE_LL_D_HLIST_NODE_PTR(p); if (ll_d_hlist_empty(&inode->i_dentry)) return NULL; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 8b52d52..74f6fb1 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -776,7 +776,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, { unsigned int num_entry; struct lprocfs_counter *percpu_cntr; - struct lprocfs_counter_header *cntr_header; int i; unsigned long flags = 0; @@ -795,7 +794,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, for (i = 0; i < num_entry; i++) { if (stats->ls_percpu[i] == NULL) continue; - cntr_header = &stats->ls_cnt_header[idx]; percpu_cntr = lprocfs_stats_counter_get(stats, i, idx); cnt->lc_count += percpu_cntr->lc_count; @@ -1357,7 +1355,6 @@ EXPORT_SYMBOL(lprocfs_free_stats); void lprocfs_clear_stats(struct lprocfs_stats *stats) { struct lprocfs_counter *percpu_cntr; - struct lprocfs_counter_header *header; int i; int j; unsigned int num_entry; @@ -1369,7 +1366,6 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats) if (stats->ls_percpu[i] == NULL) continue; for (j = 0; j < stats->ls_num; j++) { - header = &stats->ls_cnt_header[j]; percpu_cntr = lprocfs_stats_counter_get(stats, i, j); percpu_cntr->lc_count = 0; percpu_cntr->lc_min = LC_MIN_INIT; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 4fe79db..8b355e7 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -2318,7 +2318,6 @@ EXPORT_SYMBOL(ptlrpc_req_xid); int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) { int rc; - cfs_waitq_t *wq; struct l_wait_info lwi; /* @@ -2363,12 +2362,13 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) * a chance to run reply_in_callback(), and to make sure we've * unlinked before returning a req to the pool. */ - if (request->rq_set != NULL) - wq = &request->rq_set->set_waitq; - else - wq = &request->rq_reply_waitq; - for (;;) { +#ifdef __KERNEL__ + /* The wq argument is ignored by user-space wait_event macros */ + cfs_waitq_t *wq = (request->rq_set != NULL) ? + &request->rq_set->set_waitq : + &request->rq_reply_waitq; +#endif /* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK), diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 62792ab..9c1d17b 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -173,7 +173,6 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) target_len, target_start, libcfs_nid2str(imp->imp_connection->c_peer.nid)); } - ptlrpc_deactivate_timeouts(imp); IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_DISCON); spin_unlock(&imp->imp_lock); @@ -389,7 +388,6 @@ void ptlrpc_activate_import(struct obd_import *imp) spin_lock(&imp->imp_lock); imp->imp_invalid = 0; - ptlrpc_activate_timeouts(imp); spin_unlock(&imp->imp_lock); obd_import_event(obd, imp, IMP_EVENT_ACTIVE); } diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index f308a5c..0137b32 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -425,7 +425,6 @@ EXPORT_SYMBOL(ptlrpc_register_bulk); int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) { struct ptlrpc_bulk_desc *desc = req->rq_bulk; - cfs_waitq_t *wq; struct l_wait_info lwi; int rc; ENTRY; @@ -458,12 +457,13 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) if (async) RETURN(0); - if (req->rq_set != NULL) - wq = &req->rq_set->set_waitq; - else - wq = &req->rq_reply_waitq; - for (;;) { +#ifdef __KERNEL__ + /* The wq argument is ignored by user-space wait_event macros */ + cfs_waitq_t *wq = (req->rq_set != NULL) ? + &req->rq_set->set_waitq : + &req->rq_reply_waitq; +#endif /* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK), diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index ab4822b..11de560 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -148,9 +148,6 @@ static inline int ptlrpc_next_reconnect(struct obd_import *imp) return cfs_time_shift(obd_timeout); } -static cfs_atomic_t suspend_timeouts = CFS_ATOMIC_INIT(0); -static cfs_time_t suspend_wakeup_time = 0; - cfs_duration_t pinger_check_timeout(cfs_time_t time) { struct timeout_item *item; @@ -170,66 +167,6 @@ cfs_duration_t pinger_check_timeout(cfs_time_t time) cfs_time_current()); } -static cfs_waitq_t suspend_timeouts_waitq; - -cfs_time_t ptlrpc_suspend_wakeup_time(void) -{ - return suspend_wakeup_time; -} - -void ptlrpc_deactivate_timeouts(struct obd_import *imp) -{ - /*XXX: disabled for now, will be replaced by adaptive timeouts */ -#if 0 - if (imp->imp_no_timeout) - return; - imp->imp_no_timeout = 1; - cfs_atomic_inc(&suspend_timeouts); - CDEBUG(D_HA|D_WARNING, "deactivate timeouts %u\n", - cfs_atomic_read(&suspend_timeouts)); -#endif -} - -void ptlrpc_activate_timeouts(struct obd_import *imp) -{ - /*XXX: disabled for now, will be replaced by adaptive timeouts */ -#if 0 - if (!imp->imp_no_timeout) - return; - imp->imp_no_timeout = 0; - LASSERT(cfs_atomic_read(&suspend_timeouts) > 0); - if (cfs_atomic_dec_and_test(&suspend_timeouts)) { - suspend_wakeup_time = cfs_time_current(); - cfs_waitq_signal(&suspend_timeouts_waitq); - } - CDEBUG(D_HA|D_WARNING, "activate timeouts %u\n", - cfs_atomic_read(&suspend_timeouts)); -#endif -} - -int ptlrpc_check_suspend(void) -{ - if (cfs_atomic_read(&suspend_timeouts)) - return 1; - return 0; -} - -int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req) -{ - struct l_wait_info lwi; - - if (cfs_atomic_read(&suspend_timeouts)) { - DEBUG_REQ(D_NET, req, "-- suspend %d regular timeout", - cfs_atomic_read(&suspend_timeouts)); - lwi = LWI_INTR(NULL, NULL); - l_wait_event(suspend_timeouts_waitq, - cfs_atomic_read(&suspend_timeouts) == 0, &lwi); - DEBUG_REQ(D_NET, req, "-- recharge regular timeout"); - return 1; - } - return 0; -} - #ifdef __KERNEL__ static bool ir_up; @@ -392,7 +329,6 @@ int ptlrpc_start_pinger(void) RETURN(-EALREADY); cfs_waitq_init(&pinger_thread.t_ctl_waitq); - cfs_waitq_init(&suspend_timeouts_waitq); strcpy(pinger_thread.t_name, "ll_ping"); diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index ea7b457..d79c3d3 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -674,7 +674,6 @@ int ptlrpcd_idle(void *arg) int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) { int rc; - int env = 0; ENTRY; /* @@ -694,6 +693,16 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) pc->pc_set = ptlrpc_prep_set(); if (pc->pc_set == NULL) GOTO(out, rc = -ENOMEM); + +#ifndef __KERNEL__ + pc->pc_wait_callback = + liblustre_register_wait_callback("ptlrpcd_check_async_rpcs", + &ptlrpcd_check_async_rpcs, pc); + pc->pc_idle_callback = + liblustre_register_idle_callback("ptlrpcd_check_idle_rpcs", + &ptlrpcd_idle, pc); + RETURN(0); +#else /* * So far only "client" ptlrpcd uses an environment. In the future, * ptlrpcd thread (or a thread-set) has to be given an argument, @@ -701,52 +710,40 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) */ rc = lu_context_init(&pc->pc_env.le_ctx, LCT_CL_THREAD|LCT_REMEMBER); if (rc != 0) - GOTO(out, rc); + GOTO(out_set, rc); - env = 1; -#ifdef __KERNEL__ { cfs_task_t *task; if (index >= 0) { rc = ptlrpcd_bind(index, max); if (rc < 0) - GOTO(out, rc); + GOTO(out_env, rc); } task = kthread_run(ptlrpcd, pc, pc->pc_name); if (IS_ERR(task)) - GOTO(out, rc = PTR_ERR(task)); + GOTO(out_env, rc = PTR_ERR(task)); - rc = 0; wait_for_completion(&pc->pc_starting); } -#else - pc->pc_wait_callback = - liblustre_register_wait_callback("ptlrpcd_check_async_rpcs", - &ptlrpcd_check_async_rpcs, pc); - pc->pc_idle_callback = - liblustre_register_idle_callback("ptlrpcd_check_idle_rpcs", - &ptlrpcd_idle, pc); -#endif -out: - if (rc) { -#ifdef __KERNEL__ - if (pc->pc_set != NULL) { - struct ptlrpc_request_set *set = pc->pc_set; + RETURN(0); - spin_lock(&pc->pc_lock); - pc->pc_set = NULL; - spin_unlock(&pc->pc_lock); - ptlrpc_set_destroy(set); - } - if (env != 0) - lu_context_fini(&pc->pc_env.le_ctx); - clear_bit(LIOD_BIND, &pc->pc_flags); -#else - SET_BUT_UNUSED(env); -#endif - clear_bit(LIOD_START, &pc->pc_flags); +out_env: + lu_context_fini(&pc->pc_env.le_ctx); + +out_set: + if (pc->pc_set != NULL) { + struct ptlrpc_request_set *set = pc->pc_set; + + spin_lock(&pc->pc_lock); + pc->pc_set = NULL; + spin_unlock(&pc->pc_lock); + ptlrpc_set_destroy(set); } + clear_bit(LIOD_BIND, &pc->pc_flags); +#endif +out: + clear_bit(LIOD_START, &pc->pc_flags); RETURN(rc); } diff --git a/lustre/utils/lctl.c b/lustre/utils/lctl.c index 74f9ce1..b86a378 100644 --- a/lustre/utils/lctl.c +++ b/lustre/utils/lctl.c @@ -310,7 +310,7 @@ command_t cmdlist[] = { {"test_setxattr", jt_obd_test_setxattr, 0, "Set EA for files/directory on MDT by echo client\n" "usage: test_setxattr [-d parent_baseid] <-D parent_count>" - "[-b child_base_id] [-x size] [-n count] <-t time>\n"}, + "[-b child_base_id] [-n count] <-t time>\n"}, {"test_md_getattr", jt_obd_test_md_getattr, 0, "getattr files on MDT by echo client\n" "usage: test_md_getattr [-d parent_basedir] <-D parent_count>" diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index bbcb244..1e15a42 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -1209,7 +1209,6 @@ int jt_obd_md_common(int argc, char **argv, int cmd) __u64 seconds = 0; double diff; int c; - int xattr_size = 0; __u64 total_count = 0; char *name = NULL; struct jt_fid_space fid_space = {0}; @@ -1224,12 +1223,11 @@ int jt_obd_md_common(int argc, char **argv, int cmd) {"count", required_argument, 0, 'n'}, {"time", required_argument, 0, 't'}, {"version", no_argument, 0, 'v'}, - {"xattr_size", required_argument, 0, 'x'}, {0, 0, 0, 0} }; optind = 0; - while ((c = getopt_long(argc, argv, "b:c:d:D:m:n:t:vx:", + while ((c = getopt_long(argc, argv, "b:c:d:D:m:n:t:v", long_opts, NULL)) >= 0) { switch (c) { case 'b': @@ -1294,15 +1292,6 @@ int jt_obd_md_common(int argc, char **argv, int cmd) case 'v': version = 1; break; - case 'x': - xattr_size = strtoul(optarg, &end, 0); - if (*end) { - fprintf(stderr, "error: %s: xattr_size '%s'\n", - jt_cmdname(argv[0]), optarg); - return CMD_HELP; - } - SET_BUT_UNUSED(xattr_size); - break; default: fprintf(stderr, "error: %s: option '%s' " "unrecognized\n", argv[0], argv[optind - 1]);