• Home
  • Raw
  • Download

Lines Matching refs:r

207 static void recover_list_add(struct dlm_rsb *r)  in recover_list_add()  argument
209 struct dlm_ls *ls = r->res_ls; in recover_list_add()
212 if (list_empty(&r->res_recover_list)) { in recover_list_add()
213 list_add_tail(&r->res_recover_list, &ls->ls_recover_list); in recover_list_add()
215 dlm_hold_rsb(r); in recover_list_add()
220 static void recover_list_del(struct dlm_rsb *r) in recover_list_del() argument
222 struct dlm_ls *ls = r->res_ls; in recover_list_del()
225 list_del_init(&r->res_recover_list); in recover_list_del()
229 dlm_put_rsb(r); in recover_list_del()
234 struct dlm_rsb *r = NULL; in recover_list_find() local
238 list_for_each_entry(r, &ls->ls_recover_list, res_recover_list) { in recover_list_find()
239 if (id == (unsigned long) r) in recover_list_find()
242 r = NULL; in recover_list_find()
245 return r; in recover_list_find()
250 struct dlm_rsb *r, *s; in recover_list_clear() local
253 list_for_each_entry_safe(r, s, &ls->ls_recover_list, res_recover_list) { in recover_list_clear()
254 list_del_init(&r->res_recover_list); in recover_list_clear()
255 r->res_recover_locks_count = 0; in recover_list_clear()
256 dlm_put_rsb(r); in recover_list_clear()
299 static void set_master_lkbs(struct dlm_rsb *r) in set_master_lkbs() argument
301 set_lock_master(&r->res_grantqueue, r->res_nodeid); in set_master_lkbs()
302 set_lock_master(&r->res_convertqueue, r->res_nodeid); in set_master_lkbs()
303 set_lock_master(&r->res_waitqueue, r->res_nodeid); in set_master_lkbs()
313 static void set_new_master(struct dlm_rsb *r, int nodeid) in set_new_master() argument
315 lock_rsb(r); in set_new_master()
316 r->res_nodeid = nodeid; in set_new_master()
317 set_master_lkbs(r); in set_new_master()
318 rsb_set_flag(r, RSB_NEW_MASTER); in set_new_master()
319 rsb_set_flag(r, RSB_NEW_MASTER2); in set_new_master()
320 unlock_rsb(r); in set_new_master()
328 static int recover_master(struct dlm_rsb *r) in recover_master() argument
330 struct dlm_ls *ls = r->res_ls; in recover_master()
333 dir_nodeid = dlm_dir_nodeid(r); in recover_master()
336 error = dlm_dir_lookup(ls, our_nodeid, r->res_name, in recover_master()
337 r->res_length, &ret_nodeid); in recover_master()
343 set_new_master(r, ret_nodeid); in recover_master()
345 recover_list_add(r); in recover_master()
346 error = dlm_send_rcom_lookup(r, dir_nodeid); in recover_master()
357 static int recover_master_static(struct dlm_rsb *r) in recover_master_static() argument
359 int master = dlm_dir_nodeid(r); in recover_master_static()
364 if (r->res_nodeid != master) { in recover_master_static()
365 if (is_master(r)) in recover_master_static()
366 dlm_purge_mstcpy_locks(r); in recover_master_static()
367 set_new_master(r, master); in recover_master_static()
385 struct dlm_rsb *r; in dlm_recover_masters() local
391 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_masters()
399 count += recover_master_static(r); in dlm_recover_masters()
400 else if (!is_master(r) && in dlm_recover_masters()
401 (dlm_is_removed(ls, r->res_nodeid) || in dlm_recover_masters()
402 rsb_flag(r, RSB_NEW_MASTER))) { in dlm_recover_masters()
403 recover_master(r); in dlm_recover_masters()
422 struct dlm_rsb *r; in dlm_recover_master_reply() local
425 r = recover_list_find(ls, rc->rc_id); in dlm_recover_master_reply()
426 if (!r) { in dlm_recover_master_reply()
436 set_new_master(r, nodeid); in dlm_recover_master_reply()
437 recover_list_del(r); in dlm_recover_master_reply()
464 static int recover_locks_queue(struct dlm_rsb *r, struct list_head *head) in recover_locks_queue() argument
470 error = dlm_send_rcom_lock(r, lkb); in recover_locks_queue()
473 r->res_recover_locks_count++; in recover_locks_queue()
479 static int recover_locks(struct dlm_rsb *r) in recover_locks() argument
483 lock_rsb(r); in recover_locks()
485 DLM_ASSERT(!r->res_recover_locks_count, dlm_dump_rsb(r);); in recover_locks()
487 error = recover_locks_queue(r, &r->res_grantqueue); in recover_locks()
490 error = recover_locks_queue(r, &r->res_convertqueue); in recover_locks()
493 error = recover_locks_queue(r, &r->res_waitqueue); in recover_locks()
497 if (r->res_recover_locks_count) in recover_locks()
498 recover_list_add(r); in recover_locks()
500 rsb_clear_flag(r, RSB_NEW_MASTER); in recover_locks()
502 unlock_rsb(r); in recover_locks()
508 struct dlm_rsb *r; in dlm_recover_locks() local
514 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_locks()
515 if (is_master(r)) { in dlm_recover_locks()
516 rsb_clear_flag(r, RSB_NEW_MASTER); in dlm_recover_locks()
520 if (!rsb_flag(r, RSB_NEW_MASTER)) in dlm_recover_locks()
529 error = recover_locks(r); in dlm_recover_locks()
535 count += r->res_recover_locks_count; in dlm_recover_locks()
550 void dlm_recovered_lock(struct dlm_rsb *r) in dlm_recovered_lock() argument
552 DLM_ASSERT(rsb_flag(r, RSB_NEW_MASTER), dlm_dump_rsb(r);); in dlm_recovered_lock()
554 r->res_recover_locks_count--; in dlm_recovered_lock()
555 if (!r->res_recover_locks_count) { in dlm_recovered_lock()
556 rsb_clear_flag(r, RSB_NEW_MASTER); in dlm_recovered_lock()
557 recover_list_del(r); in dlm_recovered_lock()
560 if (recover_list_empty(r->res_ls)) in dlm_recovered_lock()
561 wake_up(&r->res_ls->ls_wait_general); in dlm_recovered_lock()
578 static void recover_lvb(struct dlm_rsb *r) in recover_lvb() argument
584 int lvblen = r->res_ls->ls_lvblen; in recover_lvb()
586 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { in recover_lvb()
603 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { in recover_lvb()
625 rsb_set_flag(r, RSB_VALNOTVALID); in recover_lvb()
628 if (!rsb_flag(r, RSB_NEW_MASTER2)) in recover_lvb()
631 if (!r->res_lvbptr) { in recover_lvb()
632 r->res_lvbptr = dlm_allocate_lvb(r->res_ls); in recover_lvb()
633 if (!r->res_lvbptr) in recover_lvb()
638 r->res_lvbseq = lkb->lkb_lvbseq; in recover_lvb()
639 memcpy(r->res_lvbptr, lkb->lkb_lvbptr, lvblen); in recover_lvb()
641 r->res_lvbseq = high_lkb->lkb_lvbseq; in recover_lvb()
642 memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen); in recover_lvb()
644 r->res_lvbseq = 0; in recover_lvb()
645 memset(r->res_lvbptr, 0, lvblen); in recover_lvb()
654 static void recover_conversion(struct dlm_rsb *r) in recover_conversion() argument
659 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { in recover_conversion()
667 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { in recover_conversion()
681 static void set_locks_purged(struct dlm_rsb *r) in set_locks_purged() argument
683 if (!list_empty(&r->res_waitqueue) || !list_empty(&r->res_convertqueue)) in set_locks_purged()
684 rsb_set_flag(r, RSB_LOCKS_PURGED); in set_locks_purged()
689 struct dlm_rsb *r; in dlm_recover_rsbs() local
695 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_rsbs()
696 lock_rsb(r); in dlm_recover_rsbs()
697 if (is_master(r)) { in dlm_recover_rsbs()
698 if (rsb_flag(r, RSB_RECOVER_CONVERT)) in dlm_recover_rsbs()
699 recover_conversion(r); in dlm_recover_rsbs()
700 if (rsb_flag(r, RSB_NEW_MASTER2)) in dlm_recover_rsbs()
701 set_locks_purged(r); in dlm_recover_rsbs()
702 recover_lvb(r); in dlm_recover_rsbs()
705 rsb_clear_flag(r, RSB_RECOVER_CONVERT); in dlm_recover_rsbs()
706 rsb_clear_flag(r, RSB_NEW_MASTER2); in dlm_recover_rsbs()
707 unlock_rsb(r); in dlm_recover_rsbs()
718 struct dlm_rsb *r; in dlm_create_root_list() local
730 list_for_each_entry(r, &ls->ls_rsbtbl[i].list, res_hashchain) { in dlm_create_root_list()
731 list_add(&r->res_root_list, &ls->ls_root_list); in dlm_create_root_list()
732 dlm_hold_rsb(r); in dlm_create_root_list()
744 list_for_each_entry(r, &ls->ls_rsbtbl[i].toss, res_hashchain) { in dlm_create_root_list()
745 list_add(&r->res_root_list, &ls->ls_root_list); in dlm_create_root_list()
746 dlm_hold_rsb(r); in dlm_create_root_list()
757 struct dlm_rsb *r, *safe; in dlm_release_root_list() local
760 list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) { in dlm_release_root_list()
761 list_del_init(&r->res_root_list); in dlm_release_root_list()
762 dlm_put_rsb(r); in dlm_release_root_list()
774 struct dlm_rsb *r, *safe; in dlm_clear_toss_list() local
779 list_for_each_entry_safe(r, safe, &ls->ls_rsbtbl[i].toss, in dlm_clear_toss_list()
781 if (dlm_no_directory(ls) || !is_master(r)) { in dlm_clear_toss_list()
782 list_del(&r->res_hashchain); in dlm_clear_toss_list()
783 dlm_free_rsb(r); in dlm_clear_toss_list()