dlm: proper prototypes
[safe/jmp/linux-2.6] / fs / dlm / ast.c
index 2bd1c5e..6308122 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "dlm_internal.h"
 #include "lock.h"
+#include "user.h"
 #include "ast.h"
 
 #define WAKE_ASTS  0
@@ -21,7 +22,7 @@ static struct list_head               ast_queue;
 static spinlock_t              ast_queue_lock;
 static struct task_struct *    astd_task;
 static unsigned long           astd_wakeflags;
-static struct semaphore                astd_running;
+static struct mutex            astd_running;
 
 
 void dlm_del_ast(struct dlm_lkb *lkb)
@@ -34,6 +35,12 @@ void dlm_del_ast(struct dlm_lkb *lkb)
 
 void dlm_add_ast(struct dlm_lkb *lkb, int type)
 {
+       if (lkb->lkb_flags & DLM_IFL_USER) {
+               dlm_user_add_ast(lkb, type);
+               return;
+       }
+       DLM_ASSERT(lkb->lkb_astaddr != DLM_FAKE_USER_AST, dlm_print_lkb(lkb););
+
        spin_lock(&ast_queue_lock);
        if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) {
                kref_get(&lkb->lkb_ref);
@@ -56,7 +63,7 @@ static void process_asts(void)
        int type = 0, found, bmode;
 
        for (;;) {
-               found = FALSE;
+               found = 0;
                spin_lock(&ast_queue_lock);
                list_for_each_entry(lkb, &ast_queue, lkb_astqueue) {
                        r = lkb->lkb_resource;
@@ -68,7 +75,7 @@ static void process_asts(void)
                        list_del(&lkb->lkb_astqueue);
                        type = lkb->lkb_ast_type;
                        lkb->lkb_ast_type = 0;
-                       found = TRUE;
+                       found = 1;
                        break;
                }
                spin_unlock(&ast_queue_lock);
@@ -117,10 +124,10 @@ static int dlm_astd(void *data)
                        schedule();
                set_current_state(TASK_RUNNING);
 
-               down(&astd_running);
+               mutex_lock(&astd_running);
                if (test_and_clear_bit(WAKE_ASTS, &astd_wakeflags))
                        process_asts();
-               up(&astd_running);
+               mutex_unlock(&astd_running);
        }
        return 0;
 }
@@ -140,7 +147,7 @@ int dlm_astd_start(void)
 
        INIT_LIST_HEAD(&ast_queue);
        spin_lock_init(&ast_queue_lock);
-       init_MUTEX(&astd_running);
+       mutex_init(&astd_running);
 
        p = kthread_run(dlm_astd, NULL, "dlm_astd");
        if (IS_ERR(p))
@@ -157,11 +164,11 @@ void dlm_astd_stop(void)
 
 void dlm_astd_suspend(void)
 {
-       down(&astd_running);
+       mutex_lock(&astd_running);
 }
 
 void dlm_astd_resume(void)
 {
-       up(&astd_running);
+       mutex_unlock(&astd_running);
 }