static int gdlm_thread(void *data) { struct gdlm_ls *ls = (struct gdlm_ls *) data; struct gdlm_lock *lp = NULL; int blist = 0; uint8_t complete, blocking, submit, drop; DECLARE_WAITQUEUE(wait, current); /* Only thread1 is allowed to do blocking callbacks since gfs may wait for a completion callback within a blocking cb. */ if (current == ls->thread1) blist = 1; while (!kthread_should_stop()) { set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&ls->thread_wait, &wait); if (no_work(ls, blist)) schedule(); remove_wait_queue(&ls->thread_wait, &wait); set_current_state(TASK_RUNNING); complete = blocking = submit = drop = 0; spin_lock(&ls->async_lock); if (blist && !list_empty(&ls->blocking)) { lp = list_entry(ls->blocking.next, struct gdlm_lock, blist); list_del_init(&lp->blist); blocking = lp->bast_mode; lp->bast_mode = 0; } else if (!list_empty(&ls->complete)) {
static int gdlm_thread(void *data, int blist) { struct gdlm_ls *ls = (struct gdlm_ls *) data; struct gdlm_lock *lp = NULL; uint8_t complete, blocking, submit, drop; /* Only thread1 is allowed to do blocking callbacks since gfs may wait for a completion callback within a blocking cb. */ while (!kthread_should_stop()) { wait_event_interruptible(ls->thread_wait, !no_work(ls, blist) || kthread_should_stop()); complete = blocking = submit = drop = 0; spin_lock(&ls->async_lock); if (blist && !list_empty(&ls->blocking)) { lp = list_entry(ls->blocking.next, struct gdlm_lock, blist); list_del_init(&lp->blist); blocking = lp->bast_mode; lp->bast_mode = 0; } else if (!list_empty(&ls->complete)) {