Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: move root_list functionality to recover.c

Move dlm_create_root_list() and dlm_release_root_list() to
recover.c and declare them static because they are only used
there.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Alexander Aring and committed by
David Teigland
29e345f3 455597a5

+39 -44
-42
fs/dlm/recover.c
··· 889 889 890 890 /* Create a single list of all root rsb's to be used during recovery */ 891 891 892 - int dlm_create_root_list(struct dlm_ls *ls) 893 - { 894 - struct rb_node *n; 895 - struct dlm_rsb *r; 896 - int i, error = 0; 897 - 898 - down_write(&ls->ls_root_sem); 899 - if (!list_empty(&ls->ls_root_list)) { 900 - log_error(ls, "root list not empty"); 901 - error = -EINVAL; 902 - goto out; 903 - } 904 - 905 - for (i = 0; i < ls->ls_rsbtbl_size; i++) { 906 - spin_lock(&ls->ls_rsbtbl[i].lock); 907 - for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) { 908 - r = rb_entry(n, struct dlm_rsb, res_hashnode); 909 - list_add(&r->res_root_list, &ls->ls_root_list); 910 - dlm_hold_rsb(r); 911 - } 912 - 913 - if (!RB_EMPTY_ROOT(&ls->ls_rsbtbl[i].toss)) 914 - log_error(ls, "dlm_create_root_list toss not empty"); 915 - spin_unlock(&ls->ls_rsbtbl[i].lock); 916 - } 917 - out: 918 - up_write(&ls->ls_root_sem); 919 - return error; 920 - } 921 - 922 - void dlm_release_root_list(struct dlm_ls *ls) 923 - { 924 - struct dlm_rsb *r, *safe; 925 - 926 - down_write(&ls->ls_root_sem); 927 - list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) { 928 - list_del_init(&r->res_root_list); 929 - dlm_put_rsb(r); 930 - } 931 - up_write(&ls->ls_root_sem); 932 - } 933 - 934 892 void dlm_clear_toss(struct dlm_ls *ls) 935 893 { 936 894 struct rb_node *n, *next;
-2
fs/dlm/recover.h
··· 23 23 int dlm_recover_master_reply(struct dlm_ls *ls, const struct dlm_rcom *rc); 24 24 int dlm_recover_locks(struct dlm_ls *ls, uint64_t seq); 25 25 void dlm_recovered_lock(struct dlm_rsb *r); 26 - int dlm_create_root_list(struct dlm_ls *ls); 27 - void dlm_release_root_list(struct dlm_ls *ls); 28 26 void dlm_clear_toss(struct dlm_ls *ls); 29 27 void dlm_recover_rsbs(struct dlm_ls *ls); 30 28
+39
fs/dlm/recoverd.c
··· 20 20 #include "requestqueue.h" 21 21 #include "recoverd.h" 22 22 23 + static void dlm_create_root_list(struct dlm_ls *ls) 24 + { 25 + struct rb_node *n; 26 + struct dlm_rsb *r; 27 + int i; 28 + 29 + down_write(&ls->ls_root_sem); 30 + if (!list_empty(&ls->ls_root_list)) { 31 + log_error(ls, "root list not empty"); 32 + goto out; 33 + } 34 + 35 + for (i = 0; i < ls->ls_rsbtbl_size; i++) { 36 + spin_lock_bh(&ls->ls_rsbtbl[i].lock); 37 + for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) { 38 + r = rb_entry(n, struct dlm_rsb, res_hashnode); 39 + list_add(&r->res_root_list, &ls->ls_root_list); 40 + dlm_hold_rsb(r); 41 + } 42 + 43 + if (!RB_EMPTY_ROOT(&ls->ls_rsbtbl[i].toss)) 44 + log_error(ls, "%s toss not empty", __func__); 45 + spin_unlock_bh(&ls->ls_rsbtbl[i].lock); 46 + } 47 + out: 48 + up_write(&ls->ls_root_sem); 49 + } 50 + 51 + static void dlm_release_root_list(struct dlm_ls *ls) 52 + { 53 + struct dlm_rsb *r, *safe; 54 + 55 + down_write(&ls->ls_root_sem); 56 + list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) { 57 + list_del_init(&r->res_root_list); 58 + dlm_put_rsb(r); 59 + } 60 + up_write(&ls->ls_root_sem); 61 + } 23 62 24 63 /* If the start for which we're re-enabling locking (seq) has been superseded 25 64 by a newer stop (ls_recover_seq), we need to leave locking disabled.