Whamcloud - gitweb
LU-1346 libcfs: cleanup waitq related primitives
[fs/lustre-release.git] / lustre / ldlm / ldlm_pool.c
index 723bc2b..d7347a7 100644 (file)
@@ -1340,14 +1340,14 @@ EXPORT_SYMBOL(ldlm_pools_recalc);
 
 static int ldlm_pools_thread_main(void *arg)
 {
-        struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
+       struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
        int s_time, c_time;
-        ENTRY;
+       ENTRY;
 
-        thread_set_flags(thread, SVC_RUNNING);
-        cfs_waitq_signal(&thread->t_ctl_waitq);
+       thread_set_flags(thread, SVC_RUNNING);
+       wake_up(&thread->t_ctl_waitq);
 
-        CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
+       CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
               "ldlm_poold", current_pid());
 
         while (1) {
@@ -1376,10 +1376,10 @@ static int ldlm_pools_thread_main(void *arg)
                         thread_test_and_clear_flags(thread, SVC_EVENT);
         }
 
-        thread_set_flags(thread, SVC_STOPPED);
-        cfs_waitq_signal(&thread->t_ctl_waitq);
+       thread_set_flags(thread, SVC_STOPPED);
+       wake_up(&thread->t_ctl_waitq);
 
-        CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
+       CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
                "ldlm_poold", current_pid());
 
        complete_and_exit(&ldlm_pools_comp, 0);
@@ -1399,7 +1399,7 @@ static int ldlm_pools_thread_start(void)
                RETURN(-ENOMEM);
 
        init_completion(&ldlm_pools_comp);
-       cfs_waitq_init(&ldlm_pools_thread->t_ctl_waitq);
+       init_waitqueue_head(&ldlm_pools_thread->t_ctl_waitq);
 
        task = kthread_run(ldlm_pools_thread_main, ldlm_pools_thread,
                           "ldlm_poold");
@@ -1416,25 +1416,25 @@ static int ldlm_pools_thread_start(void)
 
 static void ldlm_pools_thread_stop(void)
 {
-        ENTRY;
+       ENTRY;
 
-        if (ldlm_pools_thread == NULL) {
-                EXIT;
-                return;
-        }
+       if (ldlm_pools_thread == NULL) {
+               EXIT;
+               return;
+       }
 
-        thread_set_flags(ldlm_pools_thread, SVC_STOPPING);
-        cfs_waitq_signal(&ldlm_pools_thread->t_ctl_waitq);
+       thread_set_flags(ldlm_pools_thread, SVC_STOPPING);
+       wake_up(&ldlm_pools_thread->t_ctl_waitq);
 
-        /*
-         * Make sure that pools thread is finished before freeing @thread.
-         * This fixes possible race and oops due to accessing freed memory
-         * in pools thread.
-         */
+       /*
+        * Make sure that pools thread is finished before freeing @thread.
+        * This fixes possible race and oops due to accessing freed memory
+        * in pools thread.
+        */
        wait_for_completion(&ldlm_pools_comp);
-        OBD_FREE_PTR(ldlm_pools_thread);
-        ldlm_pools_thread = NULL;
-        EXIT;
+       OBD_FREE_PTR(ldlm_pools_thread);
+       ldlm_pools_thread = NULL;
+       EXIT;
 }
 
 int ldlm_pools_init(void)