Whamcloud - gitweb
LU-4429 llite: fix open lock matching in ll_md_blocking_ast()
[fs/lustre-release.git] / lustre / llite / llite_capa.c
index 1d489e6..7b6302d 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -167,22 +167,20 @@ static void ll_delete_capa(struct obd_capa *ocapa)
  */
 static int capa_thread_main(void *unused)
 {
-        struct obd_capa *ocapa, *tmp, *next;
-        struct inode *inode = NULL;
-        struct l_wait_info lwi = { 0 };
-        int rc;
-        ENTRY;
-
-        cfs_daemonize("ll_capa");
+       struct obd_capa *ocapa, *tmp, *next;
+       struct inode *inode = NULL;
+       struct l_wait_info lwi = { 0 };
+       int rc;
+       ENTRY;
 
-        thread_set_flags(&ll_capa_thread, SVC_RUNNING);
-        cfs_waitq_signal(&ll_capa_thread.t_ctl_waitq);
+       thread_set_flags(&ll_capa_thread, SVC_RUNNING);
+       wake_up(&ll_capa_thread.t_ctl_waitq);
 
-        while (1) {
-                l_wait_event(ll_capa_thread.t_ctl_waitq,
-                             !thread_is_running(&ll_capa_thread) ||
-                             have_expired_capa(),
-                             &lwi);
+       while (1) {
+               l_wait_event(ll_capa_thread.t_ctl_waitq,
+                            !thread_is_running(&ll_capa_thread) ||
+                            have_expired_capa(),
+                            &lwi);
 
                 if (!thread_is_running(&ll_capa_thread))
                         break;
@@ -282,39 +280,40 @@ static int capa_thread_main(void *unused)
        }
 
        thread_set_flags(&ll_capa_thread, SVC_STOPPED);
-       cfs_waitq_signal(&ll_capa_thread.t_ctl_waitq);
+       wake_up(&ll_capa_thread.t_ctl_waitq);
        RETURN(0);
 }
 
 void ll_capa_timer_callback(unsigned long unused)
 {
-        cfs_waitq_signal(&ll_capa_thread.t_ctl_waitq);
+       wake_up(&ll_capa_thread.t_ctl_waitq);
 }
 
 int ll_capa_thread_start(void)
 {
-        int rc;
-        ENTRY;
+       struct task_struct *task;
+       ENTRY;
 
-        cfs_waitq_init(&ll_capa_thread.t_ctl_waitq);
+       init_waitqueue_head(&ll_capa_thread.t_ctl_waitq);
 
-        rc = cfs_create_thread(capa_thread_main, NULL, 0);
-        if (rc < 0) {
-                CERROR("cannot start expired capa thread: rc %d\n", rc);
-                RETURN(rc);
-        }
-        cfs_wait_event(ll_capa_thread.t_ctl_waitq,
-                       thread_is_running(&ll_capa_thread));
+       task = kthread_run(capa_thread_main, NULL, "ll_capa");
+       if (IS_ERR(task)) {
+               CERROR("cannot start expired capa thread: rc %ld\n",
+                       PTR_ERR(task));
+               RETURN(PTR_ERR(task));
+       }
+       wait_event(ll_capa_thread.t_ctl_waitq,
+                      thread_is_running(&ll_capa_thread));
 
-        RETURN(0);
+       RETURN(0);
 }
 
 void ll_capa_thread_stop(void)
 {
-        thread_set_flags(&ll_capa_thread, SVC_STOPPING);
-        cfs_waitq_signal(&ll_capa_thread.t_ctl_waitq);
-        cfs_wait_event(ll_capa_thread.t_ctl_waitq,
-                       thread_is_stopped(&ll_capa_thread));
+       thread_set_flags(&ll_capa_thread, SVC_STOPPING);
+       wake_up(&ll_capa_thread.t_ctl_waitq);
+       wait_event(ll_capa_thread.t_ctl_waitq,
+                      thread_is_stopped(&ll_capa_thread));
 }
 
 struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc)