aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmdomain.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-03-09 20:55:56 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2006-06-26 17:42:39 -0400
commita3d3329159ea76bae0b3b8680691a1c3ecf5801f (patch)
treea4521103c45190ff340f918d131649a20b414b27 /fs/ocfs2/dlm/dlmdomain.c
parent65c491d833a06fd0d1383297590772c75d28155c (diff)
ocfs2: calculate lockid hash values outside of the spinlock
Fixes a performance bug - pointed out by Andrew. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 8f3a9e3106fd..a818fde24476 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -90,7 +90,6 @@ void __dlm_insert_lockres(struct dlm_ctxt *dlm,
90 assert_spin_locked(&dlm->spinlock); 90 assert_spin_locked(&dlm->spinlock);
91 91
92 q = &res->lockname; 92 q = &res->lockname;
93 q->hash = full_name_hash(q->name, q->len);
94 bucket = &(dlm->lockres_hash[q->hash % DLM_HASH_BUCKETS]); 93 bucket = &(dlm->lockres_hash[q->hash % DLM_HASH_BUCKETS]);
95 94
96 /* get a reference for our hashtable */ 95 /* get a reference for our hashtable */
@@ -100,10 +99,10 @@ void __dlm_insert_lockres(struct dlm_ctxt *dlm,
100} 99}
101 100
102struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm, 101struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
103 const char *name, 102 const char *name,
104 unsigned int len) 103 unsigned int len,
104 unsigned int hash)
105{ 105{
106 unsigned int hash;
107 struct hlist_node *iter; 106 struct hlist_node *iter;
108 struct dlm_lock_resource *tmpres=NULL; 107 struct dlm_lock_resource *tmpres=NULL;
109 struct hlist_head *bucket; 108 struct hlist_head *bucket;
@@ -112,8 +111,6 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
112 111
113 assert_spin_locked(&dlm->spinlock); 112 assert_spin_locked(&dlm->spinlock);
114 113
115 hash = full_name_hash(name, len);
116
117 bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]); 114 bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]);
118 115
119 /* check for pre-existing lock */ 116 /* check for pre-existing lock */
@@ -135,9 +132,10 @@ struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm,
135 unsigned int len) 132 unsigned int len)
136{ 133{
137 struct dlm_lock_resource *res; 134 struct dlm_lock_resource *res;
135 unsigned int hash = dlm_lockid_hash(name, len);
138 136
139 spin_lock(&dlm->spinlock); 137 spin_lock(&dlm->spinlock);
140 res = __dlm_lookup_lockres(dlm, name, len); 138 res = __dlm_lookup_lockres(dlm, name, len, hash);
141 spin_unlock(&dlm->spinlock); 139 spin_unlock(&dlm->spinlock);
142 return res; 140 return res;
143} 141}