Lines Matching refs:lkb
20 static void dlm_dump_lkb_callbacks(struct dlm_lkb *lkb) in dlm_dump_lkb_callbacks() argument
25 lkb->lkb_id, in dlm_dump_lkb_callbacks()
26 (unsigned long long)lkb->lkb_last_bast.seq, in dlm_dump_lkb_callbacks()
27 lkb->lkb_last_bast.flags, in dlm_dump_lkb_callbacks()
28 lkb->lkb_last_bast.mode, in dlm_dump_lkb_callbacks()
29 lkb->lkb_last_bast.sb_status, in dlm_dump_lkb_callbacks()
30 lkb->lkb_last_bast.sb_flags); in dlm_dump_lkb_callbacks()
33 lkb->lkb_id, in dlm_dump_lkb_callbacks()
34 (unsigned long long)lkb->lkb_last_cast.seq, in dlm_dump_lkb_callbacks()
35 lkb->lkb_last_cast.flags, in dlm_dump_lkb_callbacks()
36 lkb->lkb_last_cast.mode, in dlm_dump_lkb_callbacks()
37 lkb->lkb_last_cast.sb_status, in dlm_dump_lkb_callbacks()
38 lkb->lkb_last_cast.sb_flags); in dlm_dump_lkb_callbacks()
42 lkb->lkb_id, in dlm_dump_lkb_callbacks()
43 (unsigned long long)lkb->lkb_callbacks[i].seq, in dlm_dump_lkb_callbacks()
44 lkb->lkb_callbacks[i].flags, in dlm_dump_lkb_callbacks()
45 lkb->lkb_callbacks[i].mode, in dlm_dump_lkb_callbacks()
46 lkb->lkb_callbacks[i].sb_status, in dlm_dump_lkb_callbacks()
47 lkb->lkb_callbacks[i].sb_flags); in dlm_dump_lkb_callbacks()
51 int dlm_add_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode, in dlm_add_lkb_callback() argument
54 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_add_lkb_callback()
60 if (lkb->lkb_callbacks[i].seq) in dlm_add_lkb_callback()
71 (lkb->lkb_callbacks[i-1].flags & DLM_CB_BAST)) { in dlm_add_lkb_callback()
73 prev_seq = lkb->lkb_callbacks[i-1].seq; in dlm_add_lkb_callback()
74 prev_mode = lkb->lkb_callbacks[i-1].mode; in dlm_add_lkb_callback()
81 lkb->lkb_id, in dlm_add_lkb_callback()
91 lkb->lkb_callbacks[i].seq = seq; in dlm_add_lkb_callback()
92 lkb->lkb_callbacks[i].flags = flags; in dlm_add_lkb_callback()
93 lkb->lkb_callbacks[i].mode = mode; in dlm_add_lkb_callback()
94 lkb->lkb_callbacks[i].sb_status = status; in dlm_add_lkb_callback()
95 lkb->lkb_callbacks[i].sb_flags = (sbflags & 0x000000FF); in dlm_add_lkb_callback()
102 lkb->lkb_id, (unsigned long long)seq, in dlm_add_lkb_callback()
104 dlm_dump_lkb_callbacks(lkb); in dlm_add_lkb_callback()
112 int dlm_rem_lkb_callback(struct dlm_ls *ls, struct dlm_lkb *lkb, in dlm_rem_lkb_callback() argument
119 if (!lkb->lkb_callbacks[0].seq) { in dlm_rem_lkb_callback()
126 memcpy(cb, &lkb->lkb_callbacks[0], sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
127 memset(&lkb->lkb_callbacks[0], 0, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
132 if (!lkb->lkb_callbacks[i].seq) in dlm_rem_lkb_callback()
134 memcpy(&lkb->lkb_callbacks[i-1], &lkb->lkb_callbacks[i], in dlm_rem_lkb_callback()
136 memset(&lkb->lkb_callbacks[i], 0, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
143 if ((cb->flags & DLM_CB_BAST) && lkb->lkb_last_cast.seq) { in dlm_rem_lkb_callback()
144 if (dlm_modes_compat(cb->mode, lkb->lkb_last_cast.mode)) { in dlm_rem_lkb_callback()
149 lkb->lkb_id, in dlm_rem_lkb_callback()
152 (unsigned long long)lkb->lkb_last_cast.seq, in dlm_rem_lkb_callback()
153 lkb->lkb_last_cast.mode); in dlm_rem_lkb_callback()
160 memcpy(&lkb->lkb_last_cast, cb, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
161 lkb->lkb_last_cast_time = ktime_get(); in dlm_rem_lkb_callback()
165 memcpy(&lkb->lkb_last_bast, cb, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
166 lkb->lkb_last_bast_time = ktime_get(); in dlm_rem_lkb_callback()
173 void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status, in dlm_add_cb() argument
176 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_add_cb()
186 if (lkb->lkb_flags & DLM_IFL_USER) { in dlm_add_cb()
187 dlm_user_add_ast(lkb, flags, mode, status, sbflags, new_seq); in dlm_add_cb()
191 mutex_lock(&lkb->lkb_cb_mutex); in dlm_add_cb()
192 prev_seq = lkb->lkb_callbacks[0].seq; in dlm_add_cb()
194 rv = dlm_add_lkb_callback(lkb, flags, mode, status, sbflags, new_seq); in dlm_add_cb()
199 kref_get(&lkb->lkb_ref); in dlm_add_cb()
203 list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); in dlm_add_cb()
205 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_add_cb()
210 mutex_unlock(&lkb->lkb_cb_mutex); in dlm_add_cb()
215 struct dlm_lkb *lkb = container_of(work, struct dlm_lkb, lkb_cb_work); in dlm_callback_work() local
216 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_callback_work()
224 mutex_lock(&lkb->lkb_cb_mutex); in dlm_callback_work()
225 if (!lkb->lkb_callbacks[0].seq) { in dlm_callback_work()
227 log_error(ls, "dlm_callback_work %x no work", lkb->lkb_id); in dlm_callback_work()
228 dlm_print_lkb(lkb); in dlm_callback_work()
229 dlm_dump_lkb_callbacks(lkb); in dlm_callback_work()
233 rv = dlm_rem_lkb_callback(ls, lkb, &callbacks[i], &resid); in dlm_callback_work()
240 log_error(ls, "dlm_callback_work %x resid %d", lkb->lkb_id, in dlm_callback_work()
242 dlm_print_lkb(lkb); in dlm_callback_work()
243 dlm_dump_lkb_callbacks(lkb); in dlm_callback_work()
245 mutex_unlock(&lkb->lkb_cb_mutex); in dlm_callback_work()
247 castfn = lkb->lkb_astfn; in dlm_callback_work()
248 bastfn = lkb->lkb_bastfn; in dlm_callback_work()
256 bastfn(lkb->lkb_astparam, callbacks[i].mode); in dlm_callback_work()
258 lkb->lkb_lksb->sb_status = callbacks[i].sb_status; in dlm_callback_work()
259 lkb->lkb_lksb->sb_flags = callbacks[i].sb_flags; in dlm_callback_work()
260 castfn(lkb->lkb_astparam); in dlm_callback_work()
265 dlm_put_lkb(lkb); in dlm_callback_work()
299 struct dlm_lkb *lkb, *safe; in dlm_callback_resume() local
309 list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { in dlm_callback_resume()
310 list_del_init(&lkb->lkb_cb_list); in dlm_callback_resume()
311 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_callback_resume()