• Home
  • Raw
  • Download

Lines Matching refs:r

250 static void recover_list_add(struct dlm_rsb *r)  in recover_list_add()  argument
252 struct dlm_ls *ls = r->res_ls; in recover_list_add()
255 if (list_empty(&r->res_recover_list)) { in recover_list_add()
256 list_add_tail(&r->res_recover_list, &ls->ls_recover_list); in recover_list_add()
258 dlm_hold_rsb(r); in recover_list_add()
263 static void recover_list_del(struct dlm_rsb *r) in recover_list_del() argument
265 struct dlm_ls *ls = r->res_ls; in recover_list_del()
268 list_del_init(&r->res_recover_list); in recover_list_del()
272 dlm_put_rsb(r); in recover_list_del()
277 struct dlm_rsb *r, *s; in recover_list_clear() local
280 list_for_each_entry_safe(r, s, &ls->ls_recover_list, res_recover_list) { in recover_list_clear()
281 list_del_init(&r->res_recover_list); in recover_list_clear()
282 r->res_recover_locks_count = 0; in recover_list_clear()
283 dlm_put_rsb(r); in recover_list_clear()
307 static int recover_idr_add(struct dlm_rsb *r) in recover_idr_add() argument
309 struct dlm_ls *ls = r->res_ls; in recover_idr_add()
314 if (r->res_id) { in recover_idr_add()
318 rv = idr_alloc(&ls->ls_recover_idr, r, 1, 0, GFP_NOWAIT); in recover_idr_add()
322 r->res_id = rv; in recover_idr_add()
324 dlm_hold_rsb(r); in recover_idr_add()
332 static void recover_idr_del(struct dlm_rsb *r) in recover_idr_del() argument
334 struct dlm_ls *ls = r->res_ls; in recover_idr_del()
337 idr_remove(&ls->ls_recover_idr, r->res_id); in recover_idr_del()
338 r->res_id = 0; in recover_idr_del()
342 dlm_put_rsb(r); in recover_idr_del()
347 struct dlm_rsb *r; in recover_idr_find() local
350 r = idr_find(&ls->ls_recover_idr, (int)id); in recover_idr_find()
352 return r; in recover_idr_find()
357 struct dlm_rsb *r; in recover_idr_clear() local
362 idr_for_each_entry(&ls->ls_recover_idr, r, id) { in recover_idr_clear()
364 r->res_id = 0; in recover_idr_clear()
365 r->res_recover_locks_count = 0; in recover_idr_clear()
368 dlm_put_rsb(r); in recover_idr_clear()
413 static void set_master_lkbs(struct dlm_rsb *r) in set_master_lkbs() argument
415 set_lock_master(&r->res_grantqueue, r->res_nodeid); in set_master_lkbs()
416 set_lock_master(&r->res_convertqueue, r->res_nodeid); in set_master_lkbs()
417 set_lock_master(&r->res_waitqueue, r->res_nodeid); in set_master_lkbs()
427 static void set_new_master(struct dlm_rsb *r) in set_new_master() argument
429 set_master_lkbs(r); in set_new_master()
430 rsb_set_flag(r, RSB_NEW_MASTER); in set_new_master()
431 rsb_set_flag(r, RSB_NEW_MASTER2); in set_new_master()
444 static int recover_master(struct dlm_rsb *r, unsigned int *count) in recover_master() argument
446 struct dlm_ls *ls = r->res_ls; in recover_master()
451 if (is_master(r)) in recover_master()
454 is_removed = dlm_is_removed(ls, r->res_nodeid); in recover_master()
456 if (!is_removed && !rsb_flag(r, RSB_NEW_MASTER)) in recover_master()
460 dir_nodeid = dlm_dir_nodeid(r); in recover_master()
464 r->res_master_nodeid = our_nodeid; in recover_master()
465 r->res_nodeid = 0; in recover_master()
471 set_new_master(r); in recover_master()
474 recover_idr_add(r); in recover_master()
475 error = dlm_send_rcom_lookup(r, dir_nodeid); in recover_master()
497 static int recover_master_static(struct dlm_rsb *r, unsigned int *count) in recover_master_static() argument
499 int dir_nodeid = dlm_dir_nodeid(r); in recover_master_static()
505 dlm_purge_mstcpy_locks(r); in recover_master_static()
506 r->res_master_nodeid = dir_nodeid; in recover_master_static()
507 r->res_nodeid = new_master; in recover_master_static()
508 set_new_master(r); in recover_master_static()
525 struct dlm_rsb *r; in dlm_recover_masters() local
534 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_masters()
541 lock_rsb(r); in dlm_recover_masters()
543 error = recover_master_static(r, &count); in dlm_recover_masters()
545 error = recover_master(r, &count); in dlm_recover_masters()
546 unlock_rsb(r); in dlm_recover_masters()
568 struct dlm_rsb *r; in dlm_recover_master_reply() local
571 r = recover_idr_find(ls, rc->rc_id); in dlm_recover_master_reply()
572 if (!r) { in dlm_recover_master_reply()
585 lock_rsb(r); in dlm_recover_master_reply()
586 r->res_master_nodeid = ret_nodeid; in dlm_recover_master_reply()
587 r->res_nodeid = new_master; in dlm_recover_master_reply()
588 set_new_master(r); in dlm_recover_master_reply()
589 unlock_rsb(r); in dlm_recover_master_reply()
590 recover_idr_del(r); in dlm_recover_master_reply()
617 static int recover_locks_queue(struct dlm_rsb *r, struct list_head *head) in recover_locks_queue() argument
623 error = dlm_send_rcom_lock(r, lkb); in recover_locks_queue()
626 r->res_recover_locks_count++; in recover_locks_queue()
632 static int recover_locks(struct dlm_rsb *r) in recover_locks() argument
636 lock_rsb(r); in recover_locks()
638 DLM_ASSERT(!r->res_recover_locks_count, dlm_dump_rsb(r);); in recover_locks()
640 error = recover_locks_queue(r, &r->res_grantqueue); in recover_locks()
643 error = recover_locks_queue(r, &r->res_convertqueue); in recover_locks()
646 error = recover_locks_queue(r, &r->res_waitqueue); in recover_locks()
650 if (r->res_recover_locks_count) in recover_locks()
651 recover_list_add(r); in recover_locks()
653 rsb_clear_flag(r, RSB_NEW_MASTER); in recover_locks()
655 unlock_rsb(r); in recover_locks()
661 struct dlm_rsb *r; in dlm_recover_locks() local
665 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_locks()
666 if (is_master(r)) { in dlm_recover_locks()
667 rsb_clear_flag(r, RSB_NEW_MASTER); in dlm_recover_locks()
671 if (!rsb_flag(r, RSB_NEW_MASTER)) in dlm_recover_locks()
680 error = recover_locks(r); in dlm_recover_locks()
686 count += r->res_recover_locks_count; in dlm_recover_locks()
699 void dlm_recovered_lock(struct dlm_rsb *r) in dlm_recovered_lock() argument
701 DLM_ASSERT(rsb_flag(r, RSB_NEW_MASTER), dlm_dump_rsb(r);); in dlm_recovered_lock()
703 r->res_recover_locks_count--; in dlm_recovered_lock()
704 if (!r->res_recover_locks_count) { in dlm_recovered_lock()
705 rsb_clear_flag(r, RSB_NEW_MASTER); in dlm_recovered_lock()
706 recover_list_del(r); in dlm_recovered_lock()
709 if (recover_list_empty(r->res_ls)) in dlm_recovered_lock()
710 wake_up(&r->res_ls->ls_wait_general); in dlm_recovered_lock()
733 static void recover_lvb(struct dlm_rsb *r) in recover_lvb() argument
738 int lvblen = r->res_ls->ls_lvblen; in recover_lvb()
740 if (!rsb_flag(r, RSB_NEW_MASTER2) && in recover_lvb()
741 rsb_flag(r, RSB_RECOVER_LVB_INVAL)) { in recover_lvb()
743 rsb_set_flag(r, RSB_VALNOTVALID); in recover_lvb()
747 if (!rsb_flag(r, RSB_NEW_MASTER2)) in recover_lvb()
753 list_for_each_entry(iter, &r->res_grantqueue, lkb_statequeue) { in recover_lvb()
770 list_for_each_entry(iter, &r->res_convertqueue, lkb_statequeue) { in recover_lvb()
793 rsb_set_flag(r, RSB_VALNOTVALID); in recover_lvb()
795 if (!r->res_lvbptr) { in recover_lvb()
796 r->res_lvbptr = dlm_allocate_lvb(r->res_ls); in recover_lvb()
797 if (!r->res_lvbptr) in recover_lvb()
802 r->res_lvbseq = big_lkb->lkb_lvbseq; in recover_lvb()
803 memcpy(r->res_lvbptr, big_lkb->lkb_lvbptr, lvblen); in recover_lvb()
805 r->res_lvbseq = high_lkb->lkb_lvbseq; in recover_lvb()
806 memcpy(r->res_lvbptr, high_lkb->lkb_lvbptr, lvblen); in recover_lvb()
808 r->res_lvbseq = 0; in recover_lvb()
809 memset(r->res_lvbptr, 0, lvblen); in recover_lvb()
818 static void recover_conversion(struct dlm_rsb *r) in recover_conversion() argument
820 struct dlm_ls *ls = r->res_ls; in recover_conversion()
824 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { in recover_conversion()
832 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { in recover_conversion()
851 static void recover_grant(struct dlm_rsb *r) in recover_grant() argument
853 if (!list_empty(&r->res_waitqueue) || !list_empty(&r->res_convertqueue)) in recover_grant()
854 rsb_set_flag(r, RSB_RECOVER_GRANT); in recover_grant()
859 struct dlm_rsb *r; in dlm_recover_rsbs() local
863 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_rsbs()
864 lock_rsb(r); in dlm_recover_rsbs()
865 if (is_master(r)) { in dlm_recover_rsbs()
866 if (rsb_flag(r, RSB_RECOVER_CONVERT)) in dlm_recover_rsbs()
867 recover_conversion(r); in dlm_recover_rsbs()
871 recover_lvb(r); in dlm_recover_rsbs()
873 if (rsb_flag(r, RSB_NEW_MASTER2)) in dlm_recover_rsbs()
874 recover_grant(r); in dlm_recover_rsbs()
877 rsb_clear_flag(r, RSB_VALNOTVALID); in dlm_recover_rsbs()
879 rsb_clear_flag(r, RSB_RECOVER_CONVERT); in dlm_recover_rsbs()
880 rsb_clear_flag(r, RSB_RECOVER_LVB_INVAL); in dlm_recover_rsbs()
881 rsb_clear_flag(r, RSB_NEW_MASTER2); in dlm_recover_rsbs()
882 unlock_rsb(r); in dlm_recover_rsbs()
895 struct dlm_rsb *r; in dlm_create_root_list() local
908 r = rb_entry(n, struct dlm_rsb, res_hashnode); in dlm_create_root_list()
909 list_add(&r->res_root_list, &ls->ls_root_list); in dlm_create_root_list()
910 dlm_hold_rsb(r); in dlm_create_root_list()
924 struct dlm_rsb *r, *safe; in dlm_release_root_list() local
927 list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) { in dlm_release_root_list()
928 list_del_init(&r->res_root_list); in dlm_release_root_list()
929 dlm_put_rsb(r); in dlm_release_root_list()
937 struct dlm_rsb *r; in dlm_clear_toss() local
945 r = rb_entry(n, struct dlm_rsb, res_hashnode); in dlm_clear_toss()
947 dlm_free_rsb(r); in dlm_clear_toss()