Whamcloud - gitweb
LU-6245 libcfs: remove cfs_fs_time handling
[fs/lustre-release.git] / lnet / selftest / selftest.h
index 9c0100b..9379cbd 100644 (file)
@@ -43,8 +43,9 @@
 
 #define LNET_ONLY
 
+#include <linux/ktime.h>
 #include <libcfs/libcfs.h>
-#include <lnet/lnet.h>
+#include <lnet/api.h>
 #include <lnet/lib-lnet.h>
 #include <lnet/lib-types.h>
 #include <lnet/lnetst.h>
@@ -176,7 +177,7 @@ typedef int (*swi_action_t) (struct swi_workitem *);
 
 typedef struct swi_workitem {
        struct cfs_wi_sched     *swi_sched;
-        cfs_workitem_t       swi_workitem;
+       struct cfs_workitem       swi_workitem;
         swi_action_t         swi_action;
         int                  swi_state;
 } swi_workitem_t;
@@ -460,7 +461,7 @@ srpc_serv_is_framework(struct srpc_service *svc)
 }
 
 static inline int
-swi_wi_action(cfs_workitem_t *wi)
+swi_wi_action(struct cfs_workitem *wi)
 {
         swi_workitem_t *swi = container_of(wi, swi_workitem_t, swi_workitem);
 
@@ -574,8 +575,6 @@ swi_state2str (int state)
 #undef STATE2STR
 }
 
-#define selftest_wait_events() cfs_pause(cfs_time_seconds(1) / 10)
-
 #define lst_wait_until(cond, lock, fmt, ...)                           \
 do {                                                                   \
        int __I = 2;                                                    \
@@ -584,7 +583,8 @@ do {                                                                        \
                       fmt, ## __VA_ARGS__);                            \
                spin_unlock(&(lock));                                   \
                                                                        \
-               selftest_wait_events();                                 \
+               set_current_state(TASK_UNINTERRUPTIBLE);                \
+               schedule_timeout(cfs_time_seconds(1) / 10);             \
                                                                        \
                spin_lock(&(lock));                                     \
        }                                                               \
@@ -597,13 +597,14 @@ srpc_wait_service_shutdown(srpc_service_t *sv)
 
        LASSERT(sv->sv_shuttingdown);
 
-        while (srpc_finish_service(sv) == 0) {
-                i++;
-                CDEBUG (((i & -i) == i) ? D_WARNING : D_NET,
-                        "Waiting for %s service to shutdown...\n",
-                        sv->sv_name);
-                selftest_wait_events();
-        }
+       while (srpc_finish_service(sv) == 0) {
+               i++;
+               CDEBUG(((i & -i) == i) ? D_WARNING : D_NET,
+                      "Waiting for %s service to shutdown...\n",
+                      sv->sv_name);
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(cfs_time_seconds(1) / 10);
+       }
 }
 
 extern sfw_test_client_ops_t ping_test_client;