]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dlm: move root_list functionality to recover.c
authorAlexander Aring <aahringo@redhat.com>
Tue, 2 Apr 2024 19:17:59 +0000 (15:17 -0400)
committerDavid Teigland <teigland@redhat.com>
Tue, 9 Apr 2024 16:44:49 +0000 (11:44 -0500)
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>
fs/dlm/recover.c
fs/dlm/recover.h
fs/dlm/recoverd.c

index ce6dc914cb86da90eb833518a26b1ca70f6b1c6d..6abc283f8f36891f3629bec0c0fa0b5af34edf4f 100644 (file)
@@ -889,48 +889,6 @@ void dlm_recover_rsbs(struct dlm_ls *ls)
 
 /* Create a single list of all root rsb's to be used during recovery */
 
-int dlm_create_root_list(struct dlm_ls *ls)
-{
-       struct rb_node *n;
-       struct dlm_rsb *r;
-       int i, error = 0;
-
-       down_write(&ls->ls_root_sem);
-       if (!list_empty(&ls->ls_root_list)) {
-               log_error(ls, "root list not empty");
-               error = -EINVAL;
-               goto out;
-       }
-
-       for (i = 0; i < ls->ls_rsbtbl_size; i++) {
-               spin_lock(&ls->ls_rsbtbl[i].lock);
-               for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) {
-                       r = rb_entry(n, struct dlm_rsb, res_hashnode);
-                       list_add(&r->res_root_list, &ls->ls_root_list);
-                       dlm_hold_rsb(r);
-               }
-
-               if (!RB_EMPTY_ROOT(&ls->ls_rsbtbl[i].toss))
-                       log_error(ls, "dlm_create_root_list toss not empty");
-               spin_unlock(&ls->ls_rsbtbl[i].lock);
-       }
- out:
-       up_write(&ls->ls_root_sem);
-       return error;
-}
-
-void dlm_release_root_list(struct dlm_ls *ls)
-{
-       struct dlm_rsb *r, *safe;
-
-       down_write(&ls->ls_root_sem);
-       list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) {
-               list_del_init(&r->res_root_list);
-               dlm_put_rsb(r);
-       }
-       up_write(&ls->ls_root_sem);
-}
-
 void dlm_clear_toss(struct dlm_ls *ls)
 {
        struct rb_node *n, *next;
index dbc51013ecadba30458809883d00a0bd8d601668..0b54550ee0556d756da4065a41ecff27db2001b9 100644 (file)
@@ -23,8 +23,6 @@ int dlm_recover_masters(struct dlm_ls *ls, uint64_t seq);
 int dlm_recover_master_reply(struct dlm_ls *ls, const struct dlm_rcom *rc);
 int dlm_recover_locks(struct dlm_ls *ls, uint64_t seq);
 void dlm_recovered_lock(struct dlm_rsb *r);
-int dlm_create_root_list(struct dlm_ls *ls);
-void dlm_release_root_list(struct dlm_ls *ls);
 void dlm_clear_toss(struct dlm_ls *ls);
 void dlm_recover_rsbs(struct dlm_ls *ls);
 
index 4d17491dea2fe6f9385e7622a1f14648c81f16bf..8eb42554ccb0ae5d5a8f43f6b71ef8e2e80f6468 100644 (file)
 #include "requestqueue.h"
 #include "recoverd.h"
 
+static void dlm_create_root_list(struct dlm_ls *ls)
+{
+       struct rb_node *n;
+       struct dlm_rsb *r;
+       int i;
+
+       down_write(&ls->ls_root_sem);
+       if (!list_empty(&ls->ls_root_list)) {
+               log_error(ls, "root list not empty");
+               goto out;
+       }
+
+       for (i = 0; i < ls->ls_rsbtbl_size; i++) {
+               spin_lock_bh(&ls->ls_rsbtbl[i].lock);
+               for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) {
+                       r = rb_entry(n, struct dlm_rsb, res_hashnode);
+                       list_add(&r->res_root_list, &ls->ls_root_list);
+                       dlm_hold_rsb(r);
+               }
+
+               if (!RB_EMPTY_ROOT(&ls->ls_rsbtbl[i].toss))
+                       log_error(ls, "%s toss not empty", __func__);
+               spin_unlock_bh(&ls->ls_rsbtbl[i].lock);
+       }
+ out:
+       up_write(&ls->ls_root_sem);
+}
+
+static void dlm_release_root_list(struct dlm_ls *ls)
+{
+       struct dlm_rsb *r, *safe;
+
+       down_write(&ls->ls_root_sem);
+       list_for_each_entry_safe(r, safe, &ls->ls_root_list, res_root_list) {
+               list_del_init(&r->res_root_list);
+               dlm_put_rsb(r);
+       }
+       up_write(&ls->ls_root_sem);
+}
 
 /* If the start for which we're re-enabling locking (seq) has been superseded
    by a newer stop (ls_recover_seq), we need to leave locking disabled.