aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index a818fde24476..595b1c7cbd1f 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -103,28 +103,27 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
103 unsigned int len, 103 unsigned int len,
104 unsigned int hash) 104 unsigned int hash)
105{ 105{
106 struct hlist_node *iter;
107 struct dlm_lock_resource *tmpres=NULL;
108 struct hlist_head *bucket; 106 struct hlist_head *bucket;
107 struct hlist_node *list;
109 108
110 mlog_entry("%.*s\n", len, name); 109 mlog_entry("%.*s\n", len, name);
111 110
112 assert_spin_locked(&dlm->spinlock); 111 assert_spin_locked(&dlm->spinlock);
113 112
114 bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]); 113 bucket = dlm->lockres_hash + full_name_hash(name, len) % DLM_HASH_BUCKETS;
115 114 hlist_for_each(list, bucket) {
116 /* check for pre-existing lock */ 115 struct dlm_lock_resource *res = hlist_entry(list,
117 hlist_for_each(iter, bucket) { 116 struct dlm_lock_resource, hash_node);
118 tmpres = hlist_entry(iter, struct dlm_lock_resource, hash_node); 117 if (res->lockname.name[0] != name[0])
119 if (tmpres->lockname.len == len && 118 continue;
120 memcmp(tmpres->lockname.name, name, len) == 0) { 119 if (unlikely(res->lockname.len != len))
121 dlm_lockres_get(tmpres); 120 continue;
122 break; 121 if (memcmp(res->lockname.name + 1, name + 1, len - 1))
123 } 122 continue;
124 123 dlm_lockres_get(res);
125 tmpres = NULL; 124 return res;
126 } 125 }
127 return tmpres; 126 return NULL;
128} 127}
129 128
130struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm, 129struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm,