Whamcloud - gitweb
LU-1346 gnilnd: remove libcfs abstractions
[fs/lustre-release.git] / lnet / klnds / qswlnd / qswlnd.c
index 1c8298e..e62b094 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -172,7 +174,7 @@ kqswnal_shutdown(lnet_ni_t *ni)
        /**********************************************************************/
        /* flag threads to terminate, wake them and wait for them to die */
        kqswnal_data.kqn_shuttingdown = 2;
-       cfs_waitq_broadcast (&kqswnal_data.kqn_sched_waitq);
+       wake_up_all (&kqswnal_data.kqn_sched_waitq);
 
        while (cfs_atomic_read (&kqswnal_data.kqn_nthreads) != 0) {
                CDEBUG(D_NET, "waiting for %d threads to terminate\n",
@@ -252,7 +254,7 @@ kqswnal_shutdown(lnet_ni_t *ni)
 
        CDEBUG (D_MALLOC, "done kmem %d\n", cfs_atomic_read(&libcfs_kmemory));
 
-       PORTAL_MODULE_UNUSE;
+       module_put(THIS_MODULE);
 }
 
 int
@@ -305,11 +307,11 @@ kqswnal_startup (lnet_ni_t *ni)
        CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_readyrxds);
 
        spin_lock_init(&kqswnal_data.kqn_sched_lock);
-       cfs_waitq_init (&kqswnal_data.kqn_sched_waitq);
+       init_waitqueue_head (&kqswnal_data.kqn_sched_waitq);
 
        /* pointers/lists/locks initialised */
        kqswnal_data.kqn_init = KQN_INIT_DATA;
-       PORTAL_MODULE_USE;
+       try_module_get(THIS_MODULE);
        
        kqswnal_data.kqn_ep = ep_system();
        if (kqswnal_data.kqn_ep == NULL) {
@@ -523,8 +525,9 @@ kqswnal_startup (lnet_ni_t *ni)
 
        /**********************************************************************/
        /* Spawn scheduling threads */
-       for (i = 0; i < cfs_num_online_cpus(); i++) {
-               rc = kqswnal_thread_start (kqswnal_scheduler, NULL);
+       for (i = 0; i < num_online_cpus(); i++) {
+               rc = kqswnal_thread_start(kqswnal_scheduler, NULL,
+                                         "kqswnal_sched");
                if (rc != 0)
                {
                        CERROR ("failed to spawn scheduling thread: %d\n", rc);