Lines Matching refs:lkb
40 int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode, in dlm_enqueue_lkb_callback() argument
43 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_enqueue_lkb_callback()
53 if (lkb->lkb_last_cast) { in dlm_enqueue_lkb_callback()
54 if (dlm_modes_compat(mode, lkb->lkb_last_cast->mode)) { in dlm_enqueue_lkb_callback()
56 lkb->lkb_id, mode, in dlm_enqueue_lkb_callback()
57 lkb->lkb_last_cast->mode); in dlm_enqueue_lkb_callback()
68 if (lkb->lkb_last_cb && lkb->lkb_last_cb->flags & DLM_CB_BAST) { in dlm_enqueue_lkb_callback()
69 prev_mode = lkb->lkb_last_cb->mode; in dlm_enqueue_lkb_callback()
74 lkb->lkb_id, mode, prev_mode); in dlm_enqueue_lkb_callback()
79 if (test_bit(DLM_DFL_USER_BIT, &lkb->lkb_dflags)) { in dlm_enqueue_lkb_callback()
80 if (lkb->lkb_last_cast) in dlm_enqueue_lkb_callback()
81 prev_mode = lkb->lkb_last_cb->mode; in dlm_enqueue_lkb_callback()
85 if (!status && lkb->lkb_lksb->sb_lvbptr && in dlm_enqueue_lkb_callback()
103 if (!test_and_set_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags)) in dlm_enqueue_lkb_callback()
106 list_add_tail(&cb->list, &lkb->lkb_callbacks); in dlm_enqueue_lkb_callback()
109 dlm_callback_set_last_ptr(&lkb->lkb_last_cast, cb); in dlm_enqueue_lkb_callback()
111 dlm_callback_set_last_ptr(&lkb->lkb_last_cb, cb); in dlm_enqueue_lkb_callback()
117 int dlm_dequeue_lkb_callback(struct dlm_lkb *lkb, struct dlm_callback **cb) in dlm_dequeue_lkb_callback() argument
120 *cb = list_first_entry_or_null(&lkb->lkb_callbacks, in dlm_dequeue_lkb_callback()
127 if (list_empty(&lkb->lkb_callbacks)) in dlm_dequeue_lkb_callback()
133 void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status, in dlm_add_cb() argument
136 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_add_cb()
139 if (test_bit(DLM_DFL_USER_BIT, &lkb->lkb_dflags)) { in dlm_add_cb()
140 dlm_user_add_ast(lkb, flags, mode, status, sbflags); in dlm_add_cb()
144 spin_lock(&lkb->lkb_cb_lock); in dlm_add_cb()
145 rv = dlm_enqueue_lkb_callback(lkb, flags, mode, status, sbflags); in dlm_add_cb()
148 kref_get(&lkb->lkb_ref); in dlm_add_cb()
152 list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); in dlm_add_cb()
154 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_add_cb()
167 spin_unlock(&lkb->lkb_cb_lock); in dlm_add_cb()
172 struct dlm_lkb *lkb = container_of(work, struct dlm_lkb, lkb_cb_work); in dlm_callback_work() local
173 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_callback_work()
179 spin_lock(&lkb->lkb_cb_lock); in dlm_callback_work()
180 rv = dlm_dequeue_lkb_callback(lkb, &cb); in dlm_callback_work()
182 clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags); in dlm_callback_work()
183 spin_unlock(&lkb->lkb_cb_lock); in dlm_callback_work()
186 spin_unlock(&lkb->lkb_cb_lock); in dlm_callback_work()
189 castfn = lkb->lkb_astfn; in dlm_callback_work()
190 bastfn = lkb->lkb_bastfn; in dlm_callback_work()
193 trace_dlm_bast(ls, lkb, cb->mode); in dlm_callback_work()
194 lkb->lkb_last_bast_time = ktime_get(); in dlm_callback_work()
195 lkb->lkb_last_bast_mode = cb->mode; in dlm_callback_work()
196 bastfn(lkb->lkb_astparam, cb->mode); in dlm_callback_work()
198 lkb->lkb_lksb->sb_status = cb->sb_status; in dlm_callback_work()
199 lkb->lkb_lksb->sb_flags = cb->sb_flags; in dlm_callback_work()
200 trace_dlm_ast(ls, lkb); in dlm_callback_work()
201 lkb->lkb_last_cast_time = ktime_get(); in dlm_callback_work()
202 castfn(lkb->lkb_astparam); in dlm_callback_work()
207 spin_lock(&lkb->lkb_cb_lock); in dlm_callback_work()
208 rv = dlm_dequeue_lkb_callback(lkb, &cb); in dlm_callback_work()
210 clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags); in dlm_callback_work()
211 spin_unlock(&lkb->lkb_cb_lock); in dlm_callback_work()
214 spin_unlock(&lkb->lkb_cb_lock); in dlm_callback_work()
219 dlm_put_lkb(lkb); in dlm_callback_work()
254 struct dlm_lkb *lkb, *safe; in dlm_callback_resume() local
263 list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { in dlm_callback_resume()
264 list_del_init(&lkb->lkb_cb_list); in dlm_callback_resume()
265 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_callback_resume()