From d3caf4d58bff2ea2826b99fefc0445bb8acd0356 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 18 Mar 2014 21:05:56 +0800 Subject: [PATCH] staging/lustre/libcfs: remove cfs_pause Cc: Andreas Dilger Cc: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/libcfs_prim.h | 5 ----- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 6 ++++-- drivers/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 ++- drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 9 --------- drivers/staging/lustre/lustre/libcfs/workitem.c | 6 ++++-- 14 files changed, 38 insertions(+), 32 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h index 5d1312469cef..7cf34aa78f79 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h @@ -40,11 +40,6 @@ #ifndef __LIBCFS_PRIM_H__ #define __LIBCFS_PRIM_H__ -/* - * Schedule - */ -void cfs_pause(cfs_duration_t ticks); - /* * Timer */ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index d42c8f6d35d7..0061c8afa206 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -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); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 8f74d0be32f1..21d36ee5378a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -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); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 6150d1761c76..bdf95ea8a54d 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -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); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index cb2ecd717714..09ea6cb1492c 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -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; } diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index a18fee56147b..45c23194081b 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -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; } diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c index 286977691393..72802b0404a4 100644 --- a/drivers/staging/lustre/lnet/lnet/peer.c +++ b/drivers/staging/lustre/lnet/lnet/peer.c @@ -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); diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 8ea89428d639..995f50976c42 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -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); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 53d58924737b..8d1eea4cef6f 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -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); } diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index d838985f51cb..9fc0429e8296 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -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; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 228927e0f962..f4806a6bc942 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -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, ...) \ diff --git a/drivers/staging/lustre/lustre/include/linux/obd.h b/drivers/staging/lustre/lustre/include/linux/obd.h index 01a50265239d..dc36f75eb635 100644 --- a/drivers/staging/lustre/lustre/include/linux/obd.h +++ b/drivers/staging/lustre/lustre/include/linux/obd.h @@ -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(); } diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c index fdb4cdb143a2..9a40d1415a65 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c @@ -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); diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index 53813fca536f..ba16fd5db704 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -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); -- 2.34.1