aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2011-07-07 15:05:03 -0400
committerDavid Teigland <teigland@redhat.com>2011-07-12 17:02:09 -0400
commit3881ac04ebf94268ba3d6e486aa524fd41f893a9 (patch)
tree2ddb5c099f60f541d7e50f669f84fd58c3920bec /fs/dlm/lockspace.c
parent3d6aa675fff9eee5a6339d67b355b63a6d69565f (diff)
dlm: improve rsb searches
By pre-allocating rsb structs before searching the hash table, they can be inserted immediately. This avoids always having to repeat the search when adding the struct to hash list. This also adds space to the rsb struct for a max resource name, so an rsb allocation can be used by any request. The constant size also allows us to finally use a slab for the rsb structs. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 871fe6deb5fa..98a97762c893 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -493,6 +493,9 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
493 INIT_LIST_HEAD(&ls->ls_timeout); 493 INIT_LIST_HEAD(&ls->ls_timeout);
494 mutex_init(&ls->ls_timeout_mutex); 494 mutex_init(&ls->ls_timeout_mutex);
495 495
496 INIT_LIST_HEAD(&ls->ls_new_rsb);
497 spin_lock_init(&ls->ls_new_rsb_spin);
498
496 INIT_LIST_HEAD(&ls->ls_nodes); 499 INIT_LIST_HEAD(&ls->ls_nodes);
497 INIT_LIST_HEAD(&ls->ls_nodes_gone); 500 INIT_LIST_HEAD(&ls->ls_nodes_gone);
498 ls->ls_num_nodes = 0; 501 ls->ls_num_nodes = 0;
@@ -764,6 +767,13 @@ static int release_lockspace(struct dlm_ls *ls, int force)
764 767
765 vfree(ls->ls_rsbtbl); 768 vfree(ls->ls_rsbtbl);
766 769
770 while (!list_empty(&ls->ls_new_rsb)) {
771 rsb = list_first_entry(&ls->ls_new_rsb, struct dlm_rsb,
772 res_hashchain);
773 list_del(&rsb->res_hashchain);
774 dlm_free_rsb(rsb);
775 }
776
767 /* 777 /*
768 * Free structures on any other lists 778 * Free structures on any other lists
769 */ 779 */