Lines Matching refs:lkb
22 static void dlm_dump_lkb_callbacks(struct dlm_lkb *lkb) in dlm_dump_lkb_callbacks() argument
27 lkb->lkb_id, in dlm_dump_lkb_callbacks()
28 (unsigned long long)lkb->lkb_last_bast.seq, in dlm_dump_lkb_callbacks()
29 lkb->lkb_last_bast.flags, in dlm_dump_lkb_callbacks()
30 lkb->lkb_last_bast.mode, in dlm_dump_lkb_callbacks()
31 lkb->lkb_last_bast.sb_status, in dlm_dump_lkb_callbacks()
32 lkb->lkb_last_bast.sb_flags); in dlm_dump_lkb_callbacks()
35 lkb->lkb_id, in dlm_dump_lkb_callbacks()
36 (unsigned long long)lkb->lkb_last_cast.seq, in dlm_dump_lkb_callbacks()
37 lkb->lkb_last_cast.flags, in dlm_dump_lkb_callbacks()
38 lkb->lkb_last_cast.mode, in dlm_dump_lkb_callbacks()
39 lkb->lkb_last_cast.sb_status, in dlm_dump_lkb_callbacks()
40 lkb->lkb_last_cast.sb_flags); in dlm_dump_lkb_callbacks()
44 lkb->lkb_id, in dlm_dump_lkb_callbacks()
45 (unsigned long long)lkb->lkb_callbacks[i].seq, in dlm_dump_lkb_callbacks()
46 lkb->lkb_callbacks[i].flags, in dlm_dump_lkb_callbacks()
47 lkb->lkb_callbacks[i].mode, in dlm_dump_lkb_callbacks()
48 lkb->lkb_callbacks[i].sb_status, in dlm_dump_lkb_callbacks()
49 lkb->lkb_callbacks[i].sb_flags); in dlm_dump_lkb_callbacks()
53 int dlm_add_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode, in dlm_add_lkb_callback() argument
56 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_add_lkb_callback()
62 if (lkb->lkb_callbacks[i].seq) in dlm_add_lkb_callback()
73 (lkb->lkb_callbacks[i-1].flags & DLM_CB_BAST)) { in dlm_add_lkb_callback()
75 prev_seq = lkb->lkb_callbacks[i-1].seq; in dlm_add_lkb_callback()
76 prev_mode = lkb->lkb_callbacks[i-1].mode; in dlm_add_lkb_callback()
83 lkb->lkb_id, in dlm_add_lkb_callback()
93 lkb->lkb_callbacks[i].seq = seq; in dlm_add_lkb_callback()
94 lkb->lkb_callbacks[i].flags = flags; in dlm_add_lkb_callback()
95 lkb->lkb_callbacks[i].mode = mode; in dlm_add_lkb_callback()
96 lkb->lkb_callbacks[i].sb_status = status; in dlm_add_lkb_callback()
97 lkb->lkb_callbacks[i].sb_flags = (sbflags & 0x000000FF); in dlm_add_lkb_callback()
104 lkb->lkb_id, (unsigned long long)seq, in dlm_add_lkb_callback()
106 dlm_dump_lkb_callbacks(lkb); in dlm_add_lkb_callback()
114 int dlm_rem_lkb_callback(struct dlm_ls *ls, struct dlm_lkb *lkb, in dlm_rem_lkb_callback() argument
121 if (!lkb->lkb_callbacks[0].seq) { in dlm_rem_lkb_callback()
128 memcpy(cb, &lkb->lkb_callbacks[0], sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
129 memset(&lkb->lkb_callbacks[0], 0, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
134 if (!lkb->lkb_callbacks[i].seq) in dlm_rem_lkb_callback()
136 memcpy(&lkb->lkb_callbacks[i-1], &lkb->lkb_callbacks[i], in dlm_rem_lkb_callback()
138 memset(&lkb->lkb_callbacks[i], 0, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
145 if ((cb->flags & DLM_CB_BAST) && lkb->lkb_last_cast.seq) { in dlm_rem_lkb_callback()
146 if (dlm_modes_compat(cb->mode, lkb->lkb_last_cast.mode)) { in dlm_rem_lkb_callback()
151 lkb->lkb_id, in dlm_rem_lkb_callback()
154 (unsigned long long)lkb->lkb_last_cast.seq, in dlm_rem_lkb_callback()
155 lkb->lkb_last_cast.mode); in dlm_rem_lkb_callback()
162 memcpy(&lkb->lkb_last_cast, cb, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
163 lkb->lkb_last_cast_time = ktime_get(); in dlm_rem_lkb_callback()
167 memcpy(&lkb->lkb_last_bast, cb, sizeof(struct dlm_callback)); in dlm_rem_lkb_callback()
168 lkb->lkb_last_bast_time = ktime_get(); in dlm_rem_lkb_callback()
175 void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status, in dlm_add_cb() argument
178 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_add_cb()
188 if (lkb->lkb_flags & DLM_IFL_USER) { in dlm_add_cb()
189 dlm_user_add_ast(lkb, flags, mode, status, sbflags, new_seq); in dlm_add_cb()
193 mutex_lock(&lkb->lkb_cb_mutex); in dlm_add_cb()
194 prev_seq = lkb->lkb_callbacks[0].seq; in dlm_add_cb()
196 rv = dlm_add_lkb_callback(lkb, flags, mode, status, sbflags, new_seq); in dlm_add_cb()
201 kref_get(&lkb->lkb_ref); in dlm_add_cb()
205 list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); in dlm_add_cb()
207 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_add_cb()
212 mutex_unlock(&lkb->lkb_cb_mutex); in dlm_add_cb()
217 struct dlm_lkb *lkb = container_of(work, struct dlm_lkb, lkb_cb_work); in dlm_callback_work() local
218 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in dlm_callback_work()
226 mutex_lock(&lkb->lkb_cb_mutex); in dlm_callback_work()
227 if (!lkb->lkb_callbacks[0].seq) { in dlm_callback_work()
229 log_error(ls, "dlm_callback_work %x no work", lkb->lkb_id); in dlm_callback_work()
230 dlm_print_lkb(lkb); in dlm_callback_work()
231 dlm_dump_lkb_callbacks(lkb); in dlm_callback_work()
235 rv = dlm_rem_lkb_callback(ls, lkb, &callbacks[i], &resid); in dlm_callback_work()
242 log_error(ls, "dlm_callback_work %x resid %d", lkb->lkb_id, in dlm_callback_work()
244 dlm_print_lkb(lkb); in dlm_callback_work()
245 dlm_dump_lkb_callbacks(lkb); in dlm_callback_work()
247 mutex_unlock(&lkb->lkb_cb_mutex); in dlm_callback_work()
249 castfn = lkb->lkb_astfn; in dlm_callback_work()
250 bastfn = lkb->lkb_bastfn; in dlm_callback_work()
258 trace_dlm_bast(ls, lkb, callbacks[i].mode); in dlm_callback_work()
259 bastfn(lkb->lkb_astparam, callbacks[i].mode); in dlm_callback_work()
261 lkb->lkb_lksb->sb_status = callbacks[i].sb_status; in dlm_callback_work()
262 lkb->lkb_lksb->sb_flags = callbacks[i].sb_flags; in dlm_callback_work()
263 trace_dlm_ast(ls, lkb); in dlm_callback_work()
264 castfn(lkb->lkb_astparam); in dlm_callback_work()
269 dlm_put_lkb(lkb); in dlm_callback_work()
304 struct dlm_lkb *lkb, *safe; in dlm_callback_resume() local
315 list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) { in dlm_callback_resume()
316 list_del_init(&lkb->lkb_cb_list); in dlm_callback_resume()
317 queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); in dlm_callback_resume()