staging/lustre/libcfs: remove cfs_pause
authorPeng Tao <bergwolf@gmail.com>
Tue, 18 Mar 2014 13:05:56 +0000 (21:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Mar 2014 20:42:38 +0000 (13:42 -0700)
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>
14 files changed:
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
drivers/staging/lustre/lnet/lnet/acceptor.c
drivers/staging/lustre/lnet/lnet/api-ni.c
drivers/staging/lustre/lnet/lnet/peer.c
drivers/staging/lustre/lnet/lnet/router.c
drivers/staging/lustre/lnet/selftest/conrpc.c
drivers/staging/lustre/lnet/selftest/rpc.c
drivers/staging/lustre/lnet/selftest/selftest.h
drivers/staging/lustre/lustre/include/linux/obd.h
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
drivers/staging/lustre/lustre/libcfs/workitem.c

index 5d1312469ceffaed06bf7f6311e3e07d584cfe8d..7cf34aa78f79c5f34ae7fd5439384d778fb540fd 100644 (file)
 #ifndef __LIBCFS_PRIM_H__
 #define __LIBCFS_PRIM_H__
 
-/*
- * Schedule
- */
-void cfs_pause(cfs_duration_t ticks);
-
 /*
  * Timer
  */
index d42c8f6d35d7a118b47aa85baf0407f500ec4df5..0061c8afa206af92e5c527a1c995451c22d2ee18 100644 (file)
@@ -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);
index 8f74d0be32f10a12b2c78fb1bce45792d7d9dd6b..21d36ee5378a1ebf54d91254cd1e20409ced9d5a 100644 (file)
@@ -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);
 
index 6150d1761c76640b3fe1e93905836ee38eea9286..bdf95ea8a54decbcbb3b230544f9b366eb8882ad 100644 (file)
@@ -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);
index cb2ecd717714c39c308f80362affaee2b0db123e..09ea6cb1492cddcc5f3b33e6a89fa0a4f8c832b9 100644 (file)
@@ -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;
                }
index a18fee56147b0c554bee1ea08c8e5e2e90bdf389..45c23194081b282e36c22071b8651b91921efdc4 100644 (file)
@@ -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;
                }
index 286977691393ad509694d230a3d2b0b6e0eaa467..72802b0404a4c73b049edf67e7b236703b6f6b6a 100644 (file)
@@ -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);
index 8ea89428d639084c0c0d7ec8f0ebcd3b9308c9f2..995f50976c429899bab981387ece6df3de02533d 100644 (file)
@@ -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);
index 53d58924737ba13b7bbc8de4ccbb614f0a7f2b1e..8d1eea4cef6ffef66c1bb2b87fd6399c4186c112 100644 (file)
@@ -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);
        }
index d838985f51cb8bc15dcd333163f276192c0e2a59..9fc0429e82961b19579d525466aadf20ed4ca537 100644 (file)
@@ -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;
index 228927e0f96202c7a10cabec735babd09976b76c..f4806a6bc942d52b5bcda61a5a3369f0a59c8764 100644 (file)
@@ -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, ...)                           \
index 01a50265239d4c56ecd0464d810d4fb1027d8b29..dc36f75eb6353fce182dab039ecdad6155f13ed4 100644 (file)
@@ -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();
        }
index fdb4cdb143a2dd842ac8fca7964a3e2b43d7cec1..9a40d1415a6546d2e36550f26b5be451b323e2b7 100644 (file)
@@ -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);
index 53813fca536f00097d7e13706cb20c9b2775fd38..ba16fd5db704d775cd84deb3f53c38c34a59c5f5 100644 (file)
@@ -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);