staging/lustre/libcfs: clean up wait queue related wrappers
cover staging/lustre/libcfs: clean up wait queue related wrappers
Hi Greg,
Following patches remove wait queue related wrappers from lustre. The only thing left is add_wait_queue_exclusive_head() that we hope to make into generic helpers in a separate patch.
Thanks,
Tao
Peng Tao (5):
staging/lustre/libcfs: remove init_waitqueue_entry_current staging/lustre/libcfs: remove waitq_wait staging/lustre/libcfs: remove waitq_timedwait staging/lustre/libcfs: remove schedule_timeout_and_set_state staging/lustre/libcfs: remove cfs_pause
.../lustre/include/linux/libcfs/libcfs_prim.h | 9 ----- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 10 +++--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 6 ++- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 15 ++++---- drivers/staging/lustre/lnet/lnet/acceptor.c | 3 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 3 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 7 ++-- drivers/staging/lustre/lnet/lnet/peer.c | 3 +- drivers/staging/lustre/lnet/lnet/router.c | 12 ++++--- drivers/staging/lustre/lnet/selftest/conrpc.c | 3 +- drivers/staging/lustre/lnet/selftest/rpc.c | 3 +- drivers/staging/lustre/lnet/selftest/selftest.h | 6 +++- drivers/staging/lustre/lustre/fid/fid_request.c | 10 +++--- drivers/staging/lustre/lustre/include/linux/obd.h | 3 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 8 ++--- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +- drivers/staging/lustre/lustre/libcfs/debug.c | 4 +- drivers/staging/lustre/lustre/libcfs/fail.c | 4 +- .../lustre/lustre/libcfs/linux/linux-prim.c | 38 -------------------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 5 +-- .../staging/lustre/lustre/libcfs/upcall_cache.c | 5 +-- drivers/staging/lustre/lustre/libcfs/workitem.c | 6 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 4 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 4 +- drivers/staging/lustre/lustre/obdclass/genops.c | 4 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 4 +- drivers/staging/lustre/lustre/obdecho/echo.c | 3 +- .../staging/lustre/lustre/obdecho/echo_client.c | 4 +- .../lustre/lustre/ptlrpc/gss/gss_svc_upcall.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 4 +- 33 files changed, 89 insertions(+), 121 deletions(-)
Signature · 1 line
1.7.7.6
PATCH 1/5 staging/lustre/libcfs: remove init_waitqueue_entry_current
--- .../lustre/include/linux/libcfs/libcfs_prim.h | 1 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 6 +++--- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 6 +++--- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- .../lustre/lustre/libcfs/linux/linux-prim.c | 7 ------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- .../staging/lustre/lustre/libcfs/upcall_cache.c | 2 +- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- .../lustre/lustre/ptlrpc/gss/gss_svc_upcall.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- 16 files changed, 19 insertions(+), 27 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +0 -1
@@ -51,7 +51,6 @@ void cfs_pause(cfs_duration_t ticks);typedef void (cfs_timer_func_t )(ulong_ptr_t );void schedule_timeout_and_set_state (long ,int64_t ); -void init_waitqueue_entry_current (wait_queue_t *link);int64_t waitq_timedwait (wait_queue_t *,long ,int64_t );void waitq_wait (wait_queue_t *,long );void add_wait_queue_exclusive_head (wait_queue_head_t *,wait_queue_t *);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +3 -3
@@ -3127,7 +3127,7 @@ kiblnd_connd (void *arg)cfs_block_allsigs (); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current); kiblnd_data.kib_connd = current;spin_lock_irqsave (&kiblnd_data.kib_connd_lock, flags);
@@ -3324,7 +3324,7 @@ kiblnd_scheduler(void *arg)cfs_block_allsigs (); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current); sched = kiblnd_data.kib_scheds[KIB_THREAD_CPT (id)];
@@ -3450,7 +3450,7 @@ kiblnd_failover_thread(void *arg)cfs_block_allsigs (); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);write_lock_irqsave (glock, flags);while (!kiblnd_data.kib_shutdown) {
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +2 -2
@@ -2140,7 +2140,7 @@ ksocknal_connd (void *arg)cfs_block_allsigs (); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);spin_lock_bh (connd_lock);
@@ -2532,7 +2532,7 @@ ksocknal_reaper (void *arg)cfs_block_allsigs ();INIT_LIST_HEAD (&enomem_conns); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);spin_lock_bh (&ksocknal_data.ksnd_reaper_lock);
drivers/staging/lustre/lnet/lnet/lib-eq.c +1 -1
@@ -334,7 +334,7 @@ lnet_eq_wait_locked(int *timeout_ms)if (tms ==0 )return -1 ;/* don't want to wait and no new event */ -init_waitqueue_entry_current (&wl); +init_waitqueue_entry (&wl, current);set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&the_lnet.ln_eq_waitq, &wl);
drivers/staging/lustre/lustre/fid/fid_request.c +3 -3
@@ -256,7 +256,7 @@ int seq_client_get_seq(const struct lu_env *env,LASSERT (seqnr !=NULL );mutex_lock (&seq->lcs_mutex); -init_waitqueue_entry_current (&link); +init_waitqueue_entry (&link, current);while (1 ) { rc =seq_fid_alloc_prep (seq, &link);
@@ -306,7 +306,7 @@ int seq_client_alloc_fid(const struct lu_env *env,LASSERT (seq !=NULL );LASSERT (fid !=NULL ); -init_waitqueue_entry_current (&link); +init_waitqueue_entry (&link, current);mutex_lock (&seq->lcs_mutex);if (OBD_FAIL_CHECK (OBD_FAIL_SEQ_EXHAUST ))
@@ -370,7 +370,7 @@ void seq_client_flush(struct lu_client_seq *seq)wait_queue_t link;LASSERT (seq !=NULL ); -init_waitqueue_entry_current (&link); +init_waitqueue_entry (&link, current);mutex_lock (&seq->lcs_mutex);while (seq->lcs_update) {
drivers/staging/lustre/lustre/include/lustre_lib.h +1 -1
@@ -536,7 +536,7 @@ do { \if (condition) \break ; \ \ -init_waitqueue_entry_current (&__wait); \ +init_waitqueue_entry (&__wait, current); \l_add_wait (&wq, &__wait); \ \/* Block all signals (just the non-fatal ones if no timeout). */ \
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
@@ -1196,7 +1196,7 @@ static void cl_object_put_last(struct lu_env *env, struct cl_object *obj) bkt =lu_site_bkt_from_fid (site, &header->loh_fid); -init_waitqueue_entry_current (&waiter); +init_waitqueue_entry (&waiter, current);add_wait_queue (&bkt->lsb_marche_funebre, &waiter);while (1 ) {
drivers/staging/lustre/lustre/libcfs/debug.c +1 -1
@@ -368,7 +368,7 @@ void libcfs_debug_dumplog(void)/* we're being careful to ensure that the kernel thread is * able to set our state to running as it exits before we * get to schedule() */ -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&debug_ctlwq, &wait);
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +0 -7
@@ -46,13 +46,6 @@#include <asm/kgdb.h> #endif -void -init_waitqueue_entry_current (wait_queue_t *link) -{ -init_waitqueue_entry (link, current); -} -EXPORT_SYMBOL (init_waitqueue_entry_current); -/** * wait_queue_t of Linux (version < 2.6.34) is a FIFO list for exclusively * waiting threads, which is not always desirable because all threads will
drivers/staging/lustre/lustre/libcfs/tracefile.c +1 -1
@@ -1076,7 +1076,7 @@ end_loop:break ; } } -init_waitqueue_entry_current (&__wait); +init_waitqueue_entry (&__wait, current);add_wait_queue (&tctl->tctl_waitq, &__wait);set_current_state (TASK_INTERRUPTIBLE ); waitq_timedwait(&__wait, TASK_INTERRUPTIBLE,
drivers/staging/lustre/lustre/libcfs/upcall_cache.c +1 -1
@@ -218,7 +218,7 @@ find_again:MAX_SCHEDULE_TIMEOUT ;long left; -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);add_wait_queue (&entry->ue_waitq, &wait);set_current_state (TASK_INTERRUPTIBLE );spin_unlock (&cache->uc_lock);
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -310,7 +310,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,* ->lo_sub[] slot in lovsub_object_fini() */ if (r0->lo_sub[idx] == los) { waiter = &lov_env_info (env)->lti_waiter; -init_waitqueue_entry_current (waiter); +init_waitqueue_entry (waiter, current);add_wait_queue (&bkt->lsb_marche_funebre, waiter);set_current_state (TASK_UNINTERRUPTIBLE );while (1 ) {
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
@@ -932,7 +932,7 @@ int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)* LU-305 */ blocked =cfs_block_sigsinv (LUSTRE_FATAL_SIGS ); -init_waitqueue_entry_current (&waiter); +init_waitqueue_entry (&waiter, current);add_wait_queue (&lock->cll_wq, &waiter);set_current_state (TASK_INTERRUPTIBLE );cl_lock_mutex_put (env, lock);
drivers/staging/lustre/lustre/obdclass/lu_object.c +1 -1
@@ -571,7 +571,7 @@ static struct lu_object *htable_lookup(struct lu_site *s,* drained), and moreover, lookup has to wait until object is freed. */ -init_waitqueue_entry_current (waiter); +init_waitqueue_entry (waiter, current);add_wait_queue (&bkt->lsb_marche_funebre, waiter);set_current_state (TASK_UNINTERRUPTIBLE );lprocfs_counter_incr (s->ls_stats,LU_SS_CACHE_DEATH_RACE );
drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c +1 -1
@@ -880,7 +880,7 @@ int gss_svc_upcall_handle_init(struct ptlrpc_request *req,cache_get (&rsip->h);/* take an extra ref */ init_waitqueue_head (&rsip->waitq); -init_waitqueue_entry_current (&wait); +init_waitqueue_entry (&wait, current);add_wait_queue (&rsip->waitq, &wait); cache_check:
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -545,7 +545,7 @@ again: page_pools.epp_waitqlen;set_current_state (TASK_UNINTERRUPTIBLE ); -init_waitqueue_entry_current (&waitlink); +init_waitqueue_entry (&waitlink, current);add_wait_queue (&page_pools.epp_waitq, &waitlink);spin_unlock (&page_pools.epp_lock);
Signature · 1 line
1.7.7.6
PATCH 2/5 staging/lustre/libcfs: remove waitq_wait
--- .../lustre/include/linux/libcfs/libcfs_prim.h | 1 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 4 ++-- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- .../lustre/lustre/libcfs/linux/linux-prim.c | 7 ------- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- 12 files changed, 11 insertions(+), 19 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +0 -1
@@ -52,7 +52,6 @@ typedef void (cfs_timer_func_t)(ulong_ptr_t);void schedule_timeout_and_set_state (long ,int64_t );int64_t waitq_timedwait (wait_queue_t *,long ,int64_t ); -void waitq_wait (wait_queue_t *,long );void add_wait_queue_exclusive_head (wait_queue_head_t *,wait_queue_t *);void cfs_init_timer (struct timer_list *t);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 -1
@@ -3423,7 +3423,7 @@ kiblnd_scheduler(void *arg)add_wait_queue_exclusive (&sched->ibs_waitq, &wait);spin_unlock_irqrestore (&sched->ibs_lock, flags); -waitq_wait (&wait,TASK_INTERRUPTIBLE ); +schedule (); busy_loops =0 ;remove_wait_queue (&sched->ibs_waitq, &wait);
drivers/staging/lustre/lnet/lnet/lib-eq.c +1 -1
@@ -341,7 +341,7 @@ lnet_eq_wait_locked(int *timeout_ms)lnet_eq_wait_unlock ();if (tms <0 ) { -waitq_wait (&wl,TASK_INTERRUPTIBLE ); +schedule (); }else {struct timeval tv;
drivers/staging/lustre/lustre/fid/fid_request.c +2 -2
@@ -225,7 +225,7 @@ static int seq_fid_alloc_prep(struct lu_client_seq *seq,set_current_state (TASK_UNINTERRUPTIBLE );mutex_unlock (&seq->lcs_mutex); -waitq_wait (link,TASK_UNINTERRUPTIBLE ); +schedule ();mutex_lock (&seq->lcs_mutex);remove_wait_queue (&seq->lcs_waitq, link);
@@ -378,7 +378,7 @@ void seq_client_flush(struct lu_client_seq *seq)set_current_state (TASK_UNINTERRUPTIBLE );mutex_unlock (&seq->lcs_mutex); -waitq_wait (&link,TASK_UNINTERRUPTIBLE ); +schedule ();mutex_lock (&seq->lcs_mutex);remove_wait_queue (&seq->lcs_waitq, &link);
drivers/staging/lustre/lustre/include/lustre_lib.h +1 -1
@@ -558,7 +558,7 @@ do { \break ; \ \if (__timeout ==0 ) { \ -waitq_wait (&__wait, __wstate); \ +schedule (); \ }else { \ cfs_duration_t interval = info->lwi_interval? \ min_t(cfs_duration_t, \
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +1 -1
@@ -1203,7 +1203,7 @@ static void cl_object_put_last(struct lu_env *env, struct cl_object *obj)set_current_state (TASK_UNINTERRUPTIBLE );if (atomic_read (&header->loh_ref) ==1 )break ; -waitq_wait (&waiter,TASK_UNINTERRUPTIBLE ); +schedule (); }set_current_state (TASK_RUNNING );
drivers/staging/lustre/lustre/libcfs/debug.c +1 -1
@@ -379,7 +379,7 @@ void libcfs_debug_dumplog(void)printk (KERN_ERR "LustreError: cannot start log dump thread:" " %ld\n" ,PTR_ERR (dumper)); else - waitq_wait(&wait, TASK_INTERRUPTIBLE); +schedule ();/* be sure to teardown if cfs_create_thread() failed */ remove_wait_queue (&debug_ctlwq, &wait);
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +0 -7
@@ -70,13 +70,6 @@ add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link) }EXPORT_SYMBOL (add_wait_queue_exclusive_head); -void -waitq_wait (wait_queue_t *link,long state) -{ -schedule (); -} -EXPORT_SYMBOL (waitq_wait); -int64_t waitq_timedwait (wait_queue_t *link,long state,int64_t timeout) {
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -320,7 +320,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,spin_lock (&r0->lo_sub_lock);if (r0->lo_sub[idx] == los) {spin_unlock (&r0->lo_sub_lock); -waitq_wait (waiter,TASK_UNINTERRUPTIBLE ); +schedule (); }else {spin_unlock (&r0->lo_sub_lock);set_current_state (TASK_RUNNING );
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
@@ -943,7 +943,7 @@ int cl_lock_state_wait(const struct lu_env *env, struct cl_lock *lock)* can be restarted if signals are pending here */ result = -ERESTARTSYS ;if (likely (!OBD_FAIL_CHECK (OBD_FAIL_LOCK_STATE_WAIT_INTR ))) { -waitq_wait (&waiter,TASK_INTERRUPTIBLE ); +schedule ();if (!cfs_signal_pending ()) result =0 ; }
drivers/staging/lustre/lustre/obdclass/lu_object.c +1 -1
@@ -712,7 +712,7 @@ struct lu_object *lu_object_find_at(const struct lu_env *env,* lu_object_find_try() already added waiter into the * wait queue. */ -waitq_wait (&wait,TASK_UNINTERRUPTIBLE ); +schedule (); bkt =lu_site_bkt_from_fid (dev->ld_site, (void *)f);remove_wait_queue (&bkt->lsb_marche_funebre, &wait); }
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -549,7 +549,7 @@ again:add_wait_queue (&page_pools.epp_waitq, &waitlink);spin_unlock (&page_pools.epp_lock); -waitq_wait (&waitlink,TASK_UNINTERRUPTIBLE ); +schedule ();remove_wait_queue (&page_pools.epp_waitq, &waitlink);LASSERT (page_pools.epp_waitqlen >0 );spin_lock (&page_pools.epp_lock);
Signature · 1 line
1.7.7.6
PATCH 3/5 staging/lustre/libcfs: remove waitq_timedwait
--- .../lustre/include/linux/libcfs/libcfs_prim.h | 1 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 5 ++--- drivers/staging/lustre/lnet/lnet/lib-eq.c | 3 +-- drivers/staging/lustre/lustre/include/lustre_lib.h | 4 +--- .../lustre/lustre/libcfs/linux/linux-prim.c | 7 ------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 3 +-- .../staging/lustre/lustre/libcfs/upcall_cache.c | 3 +-- 8 files changed, 7 insertions(+), 21 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +0 -1
@@ -51,7 +51,6 @@ void cfs_pause(cfs_duration_t ticks);typedef void (cfs_timer_func_t )(ulong_ptr_t );void schedule_timeout_and_set_state (long ,int64_t ); -int64_t waitq_timedwait (wait_queue_t *,long ,int64_t );void add_wait_queue_exclusive_head (wait_queue_head_t *,wait_queue_t *);void cfs_init_timer (struct timer_list *t);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 -1
@@ -3208,7 +3208,7 @@ kiblnd_connd (void *arg)add_wait_queue (&kiblnd_data.kib_connd_waitq, &wait);spin_unlock_irqrestore (&kiblnd_data.kib_connd_lock, flags); -waitq_timedwait (&wait,TASK_INTERRUPTIBLE , timeout); +schedule_timeout (timeout);set_current_state (TASK_RUNNING );remove_wait_queue (&kiblnd_data.kib_connd_waitq, &wait);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +2 -3
@@ -2229,7 +2229,7 @@ ksocknal_connd (void *arg)spin_unlock_bh (connd_lock); nloops =0 ; -waitq_timedwait (&wait,TASK_INTERRUPTIBLE , timeout); +schedule_timeout (timeout);set_current_state (TASK_RUNNING );remove_wait_queue (&ksocknal_data.ksnd_connd_waitq, &wait);
@@ -2639,8 +2639,7 @@ ksocknal_reaper (void *arg)if (!ksocknal_data.ksnd_shuttingdown &&list_empty (&ksocknal_data.ksnd_deathrow_conns) &&list_empty (&ksocknal_data.ksnd_zombie_conns)) -waitq_timedwait (&wait,TASK_INTERRUPTIBLE , - timeout); +schedule_timeout (timeout);set_current_state (TASK_RUNNING );remove_wait_queue (&ksocknal_data.ksnd_reaper_waitq, &wait);
drivers/staging/lustre/lnet/lnet/lib-eq.c +1 -2
@@ -347,8 +347,7 @@ lnet_eq_wait_locked(int *timeout_ms)struct timeval tv; now =cfs_time_current (); -waitq_timedwait (&wl,TASK_INTERRUPTIBLE , -cfs_time_seconds (tms) /1000 ); +schedule_timeout (cfs_time_seconds (tms) /1000 );cfs_duration_usec (cfs_time_sub (cfs_time_current (), now), &tv); tms -= (int )(tv.tv_sec *1000 + tv.tv_usec /1000 );if (tms <0 )/* no more wait but may have new event */
drivers/staging/lustre/lustre/include/lustre_lib.h +1 -3
@@ -564,9 +564,7 @@ do { \min_t (cfs_duration_t, \ info->lwi_interval,__timeout):\ __timeout; \ -cfs_duration_t remaining =waitq_timedwait (&__wait,\ - __wstate, \ - interval); \ +cfs_duration_t remaining =schedule_timeout (interval);\ __timeout =cfs_time_sub (__timeout, \cfs_time_sub (interval, remaining));\if (__timeout ==0 ) { \
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +0 -7
@@ -70,13 +70,6 @@ add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link) }EXPORT_SYMBOL (add_wait_queue_exclusive_head); -int64_t -waitq_timedwait (wait_queue_t *link,long state,int64_t timeout) -{ -return schedule_timeout (timeout); -} -EXPORT_SYMBOL (waitq_timedwait); -void schedule_timeout_and_set_state (long state,int64_t timeout) {
drivers/staging/lustre/lustre/libcfs/tracefile.c +1 -2
@@ -1079,8 +1079,7 @@ end_loop:init_waitqueue_entry (&__wait, current);add_wait_queue (&tctl->tctl_waitq, &__wait);set_current_state (TASK_INTERRUPTIBLE ); -waitq_timedwait (&__wait,TASK_INTERRUPTIBLE , -cfs_time_seconds (1 )); +schedule_timeout (cfs_time_seconds (1 ));remove_wait_queue (&tctl->tctl_waitq, &__wait); }complete (&tctl->tctl_stop);
drivers/staging/lustre/lustre/libcfs/upcall_cache.c +1 -2
@@ -223,8 +223,7 @@ find_again:set_current_state (TASK_INTERRUPTIBLE );spin_unlock (&cache->uc_lock); - left =waitq_timedwait (&wait,TASK_INTERRUPTIBLE , - expiry); + left =schedule_timeout (expiry);spin_lock (&cache->uc_lock);remove_wait_queue (&entry->ue_waitq, &wait);
Signature · 1 line
1.7.7.6
PATCH 4/5 staging/lustre/libcfs: remove schedule_timeout_and_set_state
--- .../lustre/include/linux/libcfs/libcfs_prim.h | 1 - drivers/staging/lustre/lnet/lnet/router.c | 4 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 ++-- drivers/staging/lustre/lustre/libcfs/fail.c | 4 ++-- .../lustre/lustre/libcfs/linux/linux-prim.c | 8 -------- drivers/staging/lustre/lustre/obdclass/genops.c | 4 ++-- drivers/staging/lustre/lustre/obdecho/echo.c | 3 ++- .../staging/lustre/lustre/obdecho/echo_client.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 ++-- 9 files changed, 14 insertions(+), 22 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +0 -1
@@ -49,7 +49,6 @@ void cfs_pause(cfs_duration_t ticks);* Timer */ typedef void (cfs_timer_func_t )(ulong_ptr_t ); -void schedule_timeout_and_set_state (long ,int64_t );void add_wait_queue_exclusive_head (wait_queue_head_t *,wait_queue_t *);
drivers/staging/lustre/lnet/lnet/router.c +2 -2
@@ -1209,8 +1209,8 @@ rescan:/* Call cfs_pause() here always adds 1 to load average * because kernel counts # active tasks as nr_running * + nr_uninterruptible. */ -schedule_timeout_and_set_state (TASK_INTERRUPTIBLE , -cfs_time_seconds (1 )); +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); }LASSERT (the_lnet.ln_rc_state ==LNET_RC_STATE_STOPPING );
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +2 -2
@@ -192,8 +192,8 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req,if (OBD_FAIL_CHECK (OBD_FAIL_LDLM_CANCEL_BL_CB_RACE )) {int to =cfs_time_seconds (1 );while (to >0 ) { -schedule_timeout_and_set_state ( -TASK_INTERRUPTIBLE , to); +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (to);if (lock->l_granted_mode == lock->l_req_mode || lock->l_flags &LDLM_FL_DESTROYED )break ;
drivers/staging/lustre/lustre/libcfs/fail.c +2 -2
@@ -127,8 +127,8 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)if (ret) {CERROR ("cfs_fail_timeout id %x sleeping for %dms\n" , id, ms); -schedule_timeout_and_set_state (TASK_UNINTERRUPTIBLE , -cfs_time_seconds (ms) /1000 ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (ms) /1000 );set_current_state (TASK_RUNNING );CERROR ("cfs_fail_timeout id %x awake\n" , id); }
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +0 -8
@@ -70,14 +70,6 @@ add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link) }EXPORT_SYMBOL (add_wait_queue_exclusive_head); -void -schedule_timeout_and_set_state (long state,int64_t timeout) -{ -set_current_state (state); -schedule_timeout (timeout); -} -EXPORT_SYMBOL (schedule_timeout_and_set_state); -/* deschedule for a bit... */ void cfs_pause (cfs_duration_t ticks)
drivers/staging/lustre/lustre/obdclass/genops.c +2 -2
@@ -1534,8 +1534,8 @@ void obd_exports_barrier(struct obd_device *obd)spin_lock (&obd->obd_dev_lock);while (!list_empty (&obd->obd_unlinked_exports)) {spin_unlock (&obd->obd_dev_lock); -schedule_timeout_and_set_state (TASK_UNINTERRUPTIBLE , -cfs_time_seconds (waited)); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (waited));if (waited >5 &&IS_PO2 (waited)) {LCONSOLE_WARN ("%s is waiting for obd_unlinked_exports " "more than %d seconds. "
drivers/staging/lustre/lustre/obdecho/echo.c +2 -1
@@ -606,7 +606,8 @@ static int echo_cleanup(struct obd_device *obd)/* XXX Bug 3413; wait for a bit to ensure the BL callback has * happened before calling ldlm_namespace_free() */ -schedule_timeout_and_set_state (TASK_UNINTERRUPTIBLE ,cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));ldlm_namespace_free (obd->obd_namespace,NULL , obd->obd_force); obd->obd_namespace =NULL ;
drivers/staging/lustre/lustre/obdecho/echo_client.c +2 -2
@@ -997,8 +997,8 @@ static struct lu_device *echo_device_free(const struct lu_env *env,spin_unlock (&ec->ec_lock);CERROR ("echo_client still has objects at cleanup time, " "wait for 1 second\n" ); -schedule_timeout_and_set_state (TASK_UNINTERRUPTIBLE , -cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));lu_site_purge (env, &ed->ed_site->cs_lu,-1 );spin_lock (&ec->ec_lock); }
drivers/staging/lustre/lustre/ptlrpc/sec.c +2 -2
@@ -543,8 +543,8 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)"ctx (%p, fl %lx) doesn't switch, relax a little bit\n" , newctx, newctx->cc_flags); -schedule_timeout_and_set_state (TASK_INTERRUPTIBLE , -HZ ); +set_current_state (TASK_INTERRUPTIBLE ); +schedule_timeout (HZ ); }else {/* * it's possible newctx == oldctx if we're switching
Signature · 1 line
1.7.7.6
PATCH 5/5 staging/lustre/libcfs: remove cfs_pause
--- .../lustre/include/linux/libcfs/libcfs_prim.h | 5 ----- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 6 ++++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 ++++-- drivers/staging/lustre/lnet/lnet/acceptor.c | 3 ++- drivers/staging/lustre/lnet/lnet/api-ni.c | 3 ++- drivers/staging/lustre/lnet/lnet/peer.c | 3 ++- drivers/staging/lustre/lnet/lnet/router.c | 8 +++++--- drivers/staging/lustre/lnet/selftest/conrpc.c | 3 ++- drivers/staging/lustre/lnet/selftest/rpc.c | 3 ++- drivers/staging/lustre/lnet/selftest/selftest.h | 6 +++++- drivers/staging/lustre/lustre/include/linux/obd.h | 3 ++- .../lustre/lustre/libcfs/linux/linux-prim.c | 9 --------- drivers/staging/lustre/lustre/libcfs/workitem.c | 6 ++++-- 14 files changed, 38 insertions(+), 32 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +0 -5
@@ -41,11 +41,6 @@#define __LIBCFS_PRIM_H__/* -* Schedule -*/ -void cfs_pause (cfs_duration_t ticks); - -/* * Timer */ typedef void (cfs_timer_func_t )(ulong_ptr_t );
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +4 -2
@@ -2774,7 +2774,8 @@ kiblnd_base_shutdown(void)CDEBUG (((i & (-i)) == i) ?D_WARNING :D_NET ,/* power of 2? */ "Waiting for %d threads to terminate\n" ,atomic_read (&kiblnd_data.kib_nthreads)); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); }/* fall through */
@@ -2835,7 +2836,8 @@ kiblnd_shutdown (lnet_ni_t *ni)"%s: waiting for %d peers to disconnect\n" ,libcfs_nid2str (ni->ni_nid), atomic_read(&net->ibn_npeers)); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); }kiblnd_net_fini_pools (net);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +4 -2
@@ -2336,7 +2336,8 @@ ksocknal_base_shutdown(void)"waiting for %d threads to terminate\n" , ksocknal_data.ksnd_nthreads);read_unlock (&ksocknal_data.ksnd_global_lock); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));read_lock (&ksocknal_data.ksnd_global_lock); }read_unlock (&ksocknal_data.ksnd_global_lock);
@@ -2584,7 +2585,8 @@ ksocknal_shutdown (lnet_ni_t *ni)CDEBUG (((i & (-i)) == i) ?D_WARNING :D_NET ,/* power of 2? */ "waiting for %d peers to disconnect\n" , net->ksnn_npeers); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));ksocknal_debug_peerhash (ni);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +4 -2
@@ -189,7 +189,8 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)int bufnob;if (ksocknal_data.ksnd_stall_tx !=0 ) { -cfs_pause (cfs_time_seconds (ksocknal_data.ksnd_stall_tx)); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (ksocknal_data.ksnd_stall_tx)); }LASSERT (tx->tx_resid !=0 );
@@ -345,7 +346,8 @@ ksocknal_receive (ksock_conn_t *conn)int rc;if (ksocknal_data.ksnd_stall_rx !=0 ) { -cfs_pause (cfs_time_seconds (ksocknal_data.ksnd_stall_rx)); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (ksocknal_data.ksnd_stall_rx)); } rc =ksocknal_connsock_addref (conn);
drivers/staging/lustre/lnet/lnet/acceptor.c +2 -1
@@ -371,7 +371,8 @@ lnet_acceptor(void *arg)if (rc !=0 ) {if (rc != -EAGAIN ) {CWARN ("Accept error %d: pausing...\n" , rc); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); }continue ; }
drivers/staging/lustre/lnet/lnet/api-ni.c +2 -1
@@ -994,7 +994,8 @@ lnet_shutdown_lndnis (void)"Waiting for zombie LNI %s\n" , libcfs_nid2str(ni->ni_nid)); } -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));lnet_net_lock (LNET_LOCK_EX );continue ; }
drivers/staging/lustre/lnet/lnet/peer.c +2 -1
@@ -145,7 +145,8 @@ lnet_peer_tables_cleanup(void)"Waiting for %d peers on peer table\n" , ptable->pt_number); } -cfs_pause (cfs_time_seconds (1 ) /2 ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ) /2 );lnet_net_lock (i); }list_splice_init (&ptable->pt_deathrow, &deathrow);
drivers/staging/lustre/lnet/lnet/router.c +5 -3
@@ -779,7 +779,8 @@ lnet_wait_known_routerstate(void)if (all_known)return ; -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); } }
@@ -1147,7 +1148,8 @@ lnet_prune_rc_data(int wait_unlink) i++;CDEBUG (((i & (-i)) == i) ?D_WARNING :D_NET ,"Waiting for rc buffers to unlink\n" ); -cfs_pause (cfs_time_seconds (1 ) /4 ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ) /4 );lnet_net_lock (LNET_LOCK_EX ); }
@@ -1206,7 +1208,7 @@ rescan:lnet_prune_rc_data (0 );/* don't wait for UNLINK */ -/* Call cfs_pause() here always adds 1 to load average +/* Call schedule_timeout() here always adds 1 to load average * because kernel counts # active tasks as nr_running * + nr_uninterruptible. */ set_current_state (TASK_INTERRUPTIBLE );
drivers/staging/lustre/lnet/selftest/conrpc.c +2 -1
@@ -1346,7 +1346,8 @@ lstcon_rpc_cleanup_wait(void)mutex_unlock (&console_session.ses_mutex);CWARN ("Session is shutting down, waiting for termination of transactions\n" ); -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ));mutex_lock (&console_session.ses_mutex); }
drivers/staging/lustre/lnet/selftest/rpc.c +2 -1
@@ -1585,7 +1585,8 @@ srpc_startup (void)spin_lock_init (&srpc_data.rpc_glock);/* 1 second pause to avoid timestamp reuse */ -cfs_pause (cfs_time_seconds (1 )); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 )); srpc_data.rpc_matchbits = ((__u64 )cfs_time_current_sec ()) <<48 ; srpc_data.rpc_state =SRPC_STATE_NONE ;
drivers/staging/lustre/lnet/selftest/selftest.h +5 -1
@@ -572,7 +572,11 @@ swi_state2str (int state)#undef STATE2STR } -#define selftest_wait_events () cfs_pause(cfs_time_seconds(1) / 10) +#define selftest_wait_events () \ + do { \ + set_current_state(TASK_UNINTERRUPTIBLE); \ + schedule_timeout(cfs_time_seconds(1) / 10); \ + } while (0)#define lst_wait_until (cond, lock, fmt, ...) \
drivers/staging/lustre/lustre/include/linux/obd.h +2 -1
@@ -96,7 +96,8 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,LCONSOLE_WARN ("====== for current process =====\n" );dump_stack ();LCONSOLE_WARN ("====== end =======\n" ); -cfs_pause (1000 *HZ ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1000 *HZ ); }cpu_relax (); }
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +0 -9
@@ -70,15 +70,6 @@ add_wait_queue_exclusive_head(wait_queue_head_t *waitq, wait_queue_t *link) }EXPORT_SYMBOL (add_wait_queue_exclusive_head); -/* deschedule for a bit... */ -void -cfs_pause (cfs_duration_t ticks) -{ -set_current_state (TASK_UNINTERRUPTIBLE ); -schedule_timeout (ticks); -} -EXPORT_SYMBOL (cfs_pause); -void cfs_init_timer (struct timer_list *t) {init_timer (t);
drivers/staging/lustre/lustre/libcfs/workitem.c +4 -2
@@ -334,7 +334,8 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) sched->ws_nthreads, sched->ws_name);spin_unlock (&cfs_wi_data.wi_glock); -cfs_pause (cfs_time_seconds (1 ) /20 ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ) /20 );spin_lock (&cfs_wi_data.wi_glock); }
@@ -459,7 +460,8 @@ cfs_wi_shutdown (void)while (sched->ws_nthreads !=0 ) {spin_unlock (&cfs_wi_data.wi_glock); -cfs_pause (cfs_time_seconds (1 ) /20 ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (cfs_time_seconds (1 ) /20 );spin_lock (&cfs_wi_data.wi_glock); }spin_unlock (&cfs_wi_data.wi_glock);
Signature · 1 line
1.7.7.6