aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Tao <bergwolf@gmail.com>2014-03-18 09:05:56 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-19 16:42:38 -0400
commitd3caf4d58bff2ea2826b99fefc0445bb8acd0356 (patch)
treea3168e7dfcb8cd53becd0dd45163d259913d3e32
parent18fd5baa32f41b82d689d5d070577c9e2ccde986 (diff)
staging/lustre/libcfs: remove cfs_pause
Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h5
-rw-r--r--drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c6
-rw-r--r--drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c6
-rw-r--r--drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c6
-rw-r--r--drivers/staging/lustre/lnet/lnet/acceptor.c3
-rw-r--r--drivers/staging/lustre/lnet/lnet/api-ni.c3
-rw-r--r--drivers/staging/lustre/lnet/lnet/peer.c3
-rw-r--r--drivers/staging/lustre/lnet/lnet/router.c8
-rw-r--r--drivers/staging/lustre/lnet/selftest/conrpc.c3
-rw-r--r--drivers/staging/lustre/lnet/selftest/rpc.c3
-rw-r--r--drivers/staging/lustre/lnet/selftest/selftest.h6
-rw-r--r--drivers/staging/lustre/lustre/include/linux/obd.h3
-rw-r--r--drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c9
-rw-r--r--drivers/staging/lustre/lustre/libcfs/workitem.c6
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
@@ -41,11 +41,6 @@
41#define __LIBCFS_PRIM_H__ 41#define __LIBCFS_PRIM_H__
42 42
43/* 43/*
44 * Schedule
45 */
46void cfs_pause(cfs_duration_t ticks);
47
48/*
49 * Timer 44 * Timer
50 */ 45 */
51typedef void (cfs_timer_func_t)(ulong_ptr_t); 46typedef void (cfs_timer_func_t)(ulong_ptr_t);
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)
2774 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, /* power of 2? */ 2774 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, /* power of 2? */
2775 "Waiting for %d threads to terminate\n", 2775 "Waiting for %d threads to terminate\n",
2776 atomic_read(&kiblnd_data.kib_nthreads)); 2776 atomic_read(&kiblnd_data.kib_nthreads));
2777 cfs_pause(cfs_time_seconds(1)); 2777 set_current_state(TASK_UNINTERRUPTIBLE);
2778 schedule_timeout(cfs_time_seconds(1));
2778 } 2779 }
2779 2780
2780 /* fall through */ 2781 /* fall through */
@@ -2835,7 +2836,8 @@ kiblnd_shutdown (lnet_ni_t *ni)
2835 "%s: waiting for %d peers to disconnect\n", 2836 "%s: waiting for %d peers to disconnect\n",
2836 libcfs_nid2str(ni->ni_nid), 2837 libcfs_nid2str(ni->ni_nid),
2837 atomic_read(&net->ibn_npeers)); 2838 atomic_read(&net->ibn_npeers));
2838 cfs_pause(cfs_time_seconds(1)); 2839 set_current_state(TASK_UNINTERRUPTIBLE);
2840 schedule_timeout(cfs_time_seconds(1));
2839 } 2841 }
2840 2842
2841 kiblnd_net_fini_pools(net); 2843 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)
2336 "waiting for %d threads to terminate\n", 2336 "waiting for %d threads to terminate\n",
2337 ksocknal_data.ksnd_nthreads); 2337 ksocknal_data.ksnd_nthreads);
2338 read_unlock(&ksocknal_data.ksnd_global_lock); 2338 read_unlock(&ksocknal_data.ksnd_global_lock);
2339 cfs_pause(cfs_time_seconds(1)); 2339 set_current_state(TASK_UNINTERRUPTIBLE);
2340 schedule_timeout(cfs_time_seconds(1));
2340 read_lock(&ksocknal_data.ksnd_global_lock); 2341 read_lock(&ksocknal_data.ksnd_global_lock);
2341 } 2342 }
2342 read_unlock(&ksocknal_data.ksnd_global_lock); 2343 read_unlock(&ksocknal_data.ksnd_global_lock);
@@ -2584,7 +2585,8 @@ ksocknal_shutdown (lnet_ni_t *ni)
2584 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, /* power of 2? */ 2585 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, /* power of 2? */
2585 "waiting for %d peers to disconnect\n", 2586 "waiting for %d peers to disconnect\n",
2586 net->ksnn_npeers); 2587 net->ksnn_npeers);
2587 cfs_pause(cfs_time_seconds(1)); 2588 set_current_state(TASK_UNINTERRUPTIBLE);
2589 schedule_timeout(cfs_time_seconds(1));
2588 2590
2589 ksocknal_debug_peerhash(ni); 2591 ksocknal_debug_peerhash(ni);
2590 2592
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)
189 int bufnob; 189 int bufnob;
190 190
191 if (ksocknal_data.ksnd_stall_tx != 0) { 191 if (ksocknal_data.ksnd_stall_tx != 0) {
192 cfs_pause(cfs_time_seconds(ksocknal_data.ksnd_stall_tx)); 192 set_current_state(TASK_UNINTERRUPTIBLE);
193 schedule_timeout(cfs_time_seconds(ksocknal_data.ksnd_stall_tx));
193 } 194 }
194 195
195 LASSERT (tx->tx_resid != 0); 196 LASSERT (tx->tx_resid != 0);
@@ -345,7 +346,8 @@ ksocknal_receive (ksock_conn_t *conn)
345 int rc; 346 int rc;
346 347
347 if (ksocknal_data.ksnd_stall_rx != 0) { 348 if (ksocknal_data.ksnd_stall_rx != 0) {
348 cfs_pause(cfs_time_seconds (ksocknal_data.ksnd_stall_rx)); 349 set_current_state(TASK_UNINTERRUPTIBLE);
350 schedule_timeout(cfs_time_seconds(ksocknal_data.ksnd_stall_rx));
349 } 351 }
350 352
351 rc = ksocknal_connsock_addref(conn); 353 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)
371 if (rc != 0) { 371 if (rc != 0) {
372 if (rc != -EAGAIN) { 372 if (rc != -EAGAIN) {
373 CWARN("Accept error %d: pausing...\n", rc); 373 CWARN("Accept error %d: pausing...\n", rc);
374 cfs_pause(cfs_time_seconds(1)); 374 set_current_state(TASK_UNINTERRUPTIBLE);
375 schedule_timeout(cfs_time_seconds(1));
375 } 376 }
376 continue; 377 continue;
377 } 378 }
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)
994 "Waiting for zombie LNI %s\n", 994 "Waiting for zombie LNI %s\n",
995 libcfs_nid2str(ni->ni_nid)); 995 libcfs_nid2str(ni->ni_nid));
996 } 996 }
997 cfs_pause(cfs_time_seconds(1)); 997 set_current_state(TASK_UNINTERRUPTIBLE);
998 schedule_timeout(cfs_time_seconds(1));
998 lnet_net_lock(LNET_LOCK_EX); 999 lnet_net_lock(LNET_LOCK_EX);
999 continue; 1000 continue;
1000 } 1001 }
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)
145 "Waiting for %d peers on peer table\n", 145 "Waiting for %d peers on peer table\n",
146 ptable->pt_number); 146 ptable->pt_number);
147 } 147 }
148 cfs_pause(cfs_time_seconds(1) / 2); 148 set_current_state(TASK_UNINTERRUPTIBLE);
149 schedule_timeout(cfs_time_seconds(1) / 2);
149 lnet_net_lock(i); 150 lnet_net_lock(i);
150 } 151 }
151 list_splice_init(&ptable->pt_deathrow, &deathrow); 152 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)
779 if (all_known) 779 if (all_known)
780 return; 780 return;
781 781
782 cfs_pause(cfs_time_seconds(1)); 782 set_current_state(TASK_UNINTERRUPTIBLE);
783 schedule_timeout(cfs_time_seconds(1));
783 } 784 }
784} 785}
785 786
@@ -1147,7 +1148,8 @@ lnet_prune_rc_data(int wait_unlink)
1147 i++; 1148 i++;
1148 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET, 1149 CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET,
1149 "Waiting for rc buffers to unlink\n"); 1150 "Waiting for rc buffers to unlink\n");
1150 cfs_pause(cfs_time_seconds(1) / 4); 1151 set_current_state(TASK_UNINTERRUPTIBLE);
1152 schedule_timeout(cfs_time_seconds(1) / 4);
1151 1153
1152 lnet_net_lock(LNET_LOCK_EX); 1154 lnet_net_lock(LNET_LOCK_EX);
1153 } 1155 }
@@ -1206,7 +1208,7 @@ rescan:
1206 1208
1207 lnet_prune_rc_data(0); /* don't wait for UNLINK */ 1209 lnet_prune_rc_data(0); /* don't wait for UNLINK */
1208 1210
1209 /* Call cfs_pause() here always adds 1 to load average 1211 /* Call schedule_timeout() here always adds 1 to load average
1210 * because kernel counts # active tasks as nr_running 1212 * because kernel counts # active tasks as nr_running
1211 * + nr_uninterruptible. */ 1213 * + nr_uninterruptible. */
1212 set_current_state(TASK_INTERRUPTIBLE); 1214 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)
1346 mutex_unlock(&console_session.ses_mutex); 1346 mutex_unlock(&console_session.ses_mutex);
1347 1347
1348 CWARN("Session is shutting down, waiting for termination of transactions\n"); 1348 CWARN("Session is shutting down, waiting for termination of transactions\n");
1349 cfs_pause(cfs_time_seconds(1)); 1349 set_current_state(TASK_UNINTERRUPTIBLE);
1350 schedule_timeout(cfs_time_seconds(1));
1350 1351
1351 mutex_lock(&console_session.ses_mutex); 1352 mutex_lock(&console_session.ses_mutex);
1352 } 1353 }
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)
1585 spin_lock_init(&srpc_data.rpc_glock); 1585 spin_lock_init(&srpc_data.rpc_glock);
1586 1586
1587 /* 1 second pause to avoid timestamp reuse */ 1587 /* 1 second pause to avoid timestamp reuse */
1588 cfs_pause(cfs_time_seconds(1)); 1588 set_current_state(TASK_UNINTERRUPTIBLE);
1589 schedule_timeout(cfs_time_seconds(1));
1589 srpc_data.rpc_matchbits = ((__u64) cfs_time_current_sec()) << 48; 1590 srpc_data.rpc_matchbits = ((__u64) cfs_time_current_sec()) << 48;
1590 1591
1591 srpc_data.rpc_state = SRPC_STATE_NONE; 1592 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)
572#undef STATE2STR 572#undef STATE2STR
573} 573}
574 574
575#define selftest_wait_events() cfs_pause(cfs_time_seconds(1) / 10) 575#define selftest_wait_events() \
576 do { \
577 set_current_state(TASK_UNINTERRUPTIBLE); \
578 schedule_timeout(cfs_time_seconds(1) / 10); \
579 } while (0)
576 580
577 581
578#define lst_wait_until(cond, lock, fmt, ...) \ 582#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,
96 LCONSOLE_WARN("====== for current process =====\n"); 96 LCONSOLE_WARN("====== for current process =====\n");
97 dump_stack(); 97 dump_stack();
98 LCONSOLE_WARN("====== end =======\n"); 98 LCONSOLE_WARN("====== end =======\n");
99 cfs_pause(1000 * HZ); 99 set_current_state(TASK_UNINTERRUPTIBLE);
100 schedule_timeout(1000 * HZ);
100 } 101 }
101 cpu_relax(); 102 cpu_relax();
102 } 103 }
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)
70} 70}
71EXPORT_SYMBOL(add_wait_queue_exclusive_head); 71EXPORT_SYMBOL(add_wait_queue_exclusive_head);
72 72
73/* deschedule for a bit... */
74void
75cfs_pause(cfs_duration_t ticks)
76{
77 set_current_state(TASK_UNINTERRUPTIBLE);
78 schedule_timeout(ticks);
79}
80EXPORT_SYMBOL(cfs_pause);
81
82void cfs_init_timer(struct timer_list *t) 73void cfs_init_timer(struct timer_list *t)
83{ 74{
84 init_timer(t); 75 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)
334 sched->ws_nthreads, sched->ws_name); 334 sched->ws_nthreads, sched->ws_name);
335 335
336 spin_unlock(&cfs_wi_data.wi_glock); 336 spin_unlock(&cfs_wi_data.wi_glock);
337 cfs_pause(cfs_time_seconds(1) / 20); 337 set_current_state(TASK_UNINTERRUPTIBLE);
338 schedule_timeout(cfs_time_seconds(1) / 20);
338 spin_lock(&cfs_wi_data.wi_glock); 339 spin_lock(&cfs_wi_data.wi_glock);
339 } 340 }
340 341
@@ -459,7 +460,8 @@ cfs_wi_shutdown (void)
459 460
460 while (sched->ws_nthreads != 0) { 461 while (sched->ws_nthreads != 0) {
461 spin_unlock(&cfs_wi_data.wi_glock); 462 spin_unlock(&cfs_wi_data.wi_glock);
462 cfs_pause(cfs_time_seconds(1) / 20); 463 set_current_state(TASK_UNINTERRUPTIBLE);
464 schedule_timeout(cfs_time_seconds(1) / 20);
463 spin_lock(&cfs_wi_data.wi_glock); 465 spin_lock(&cfs_wi_data.wi_glock);
464 } 466 }
465 spin_unlock(&cfs_wi_data.wi_glock); 467 spin_unlock(&cfs_wi_data.wi_glock);