dlm: use idr instead of list for recovered rsbs
David Teigland
maintainerPATCH 2/6 dlm: use idr instead of list for recovered rsbs
When a large number of resources are being recovered, a linear search of the recover_list takes a long time. Use an idr in place of a list.
Signed-off-by David Teigland <[email protected]>
--- fs/dlm/dlm_internal.h | 3 ++ fs/dlm/lockspace.c | 3 ++ fs/dlm/rcom.c | 2 +- fs/dlm/recover.c | 116 +++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 101 insertions(+), 23 deletions(-)
fs/dlm/dlm_internal.h +3 -0
@@ -288,6 +288,7 @@ struct dlm_rsb {int res_nodeid;int res_master_nodeid;int res_dir_nodeid; +int res_id;/* for ls_recover_idr */ uint32_t res_lvbseq;uint32_t res_hash;uint32_t res_bucket;/* rsbtbl */
@@ -587,6 +588,8 @@ struct dlm_ls {struct list_head ls_recover_list;spinlock_t ls_recover_list_lock;int ls_recover_list_count; +struct idr ls_recover_idr; +spinlock_t ls_recover_idr_lock;wait_queue_head_t ls_wait_general;struct mutex ls_clear_proc_locks;
fs/dlm/lockspace.c +3 -0
@@ -565,6 +565,8 @@ static int new_lockspace(const char *name, const char *cluster,INIT_LIST_HEAD (&ls->ls_recover_list);spin_lock_init (&ls->ls_recover_list_lock); +idr_init (&ls->ls_recover_idr); +spin_lock_init (&ls->ls_recover_idr_lock); ls->ls_recover_list_count =0 ; ls->ls_local_handle = ls;init_waitqueue_head (&ls->ls_wait_general);
@@ -636,6 +638,7 @@ static int new_lockspace(const char *name, const char *cluster,spin_lock (&lslist_lock);list_del (&ls->ls_list);spin_unlock (&lslist_lock); +idr_destroy (&ls->ls_recover_idr);kfree (ls->ls_recover_buf); out_lkbfree:idr_destroy (&ls->ls_lkbidr);
fs/dlm/rcom.c +1 -1
@@ -325,7 +325,7 @@ int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)if (error) goto out;memcpy (rc->rc_buf, r->res_name, r->res_length); - rc->rc_id = (unsigned long ) r; + rc->rc_id = (unsigned long ) r->res_id;send_rcom (ls, mh, rc); out:
fs/dlm/recover.c +94 -22
155 lines not on this page · raw message
Signature · 1 line
1.7.10.1.362.g242cab3