diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index dbb17c07656a..8b3382abf840 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -193,7 +193,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, | |||
193 | unsigned int hash) | 193 | unsigned int hash) |
194 | { | 194 | { |
195 | struct hlist_head *bucket; | 195 | struct hlist_head *bucket; |
196 | struct hlist_node *list; | 196 | struct dlm_lock_resource *res; |
197 | 197 | ||
198 | mlog(0, "%.*s\n", len, name); | 198 | mlog(0, "%.*s\n", len, name); |
199 | 199 | ||
@@ -201,9 +201,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, | |||
201 | 201 | ||
202 | bucket = dlm_lockres_hash(dlm, hash); | 202 | bucket = dlm_lockres_hash(dlm, hash); |
203 | 203 | ||
204 | hlist_for_each(list, bucket) { | 204 | hlist_for_each_entry(res, bucket, hash_node) { |
205 | struct dlm_lock_resource *res = hlist_entry(list, | ||
206 | struct dlm_lock_resource, hash_node); | ||
207 | if (res->lockname.name[0] != name[0]) | 205 | if (res->lockname.name[0] != name[0]) |
208 | continue; | 206 | continue; |
209 | if (unlikely(res->lockname.len != len)) | 207 | if (unlikely(res->lockname.len != len)) |
@@ -262,22 +260,19 @@ struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm, | |||
262 | 260 | ||
263 | static struct dlm_ctxt * __dlm_lookup_domain_full(const char *domain, int len) | 261 | static struct dlm_ctxt * __dlm_lookup_domain_full(const char *domain, int len) |
264 | { | 262 | { |
265 | struct dlm_ctxt *tmp = NULL; | 263 | struct dlm_ctxt *tmp; |
266 | struct list_head *iter; | ||
267 | 264 | ||
268 | assert_spin_locked(&dlm_domain_lock); | 265 | assert_spin_locked(&dlm_domain_lock); |
269 | 266 | ||
270 | /* tmp->name here is always NULL terminated, | 267 | /* tmp->name here is always NULL terminated, |
271 | * but domain may not be! */ | 268 | * but domain may not be! */ |
272 | list_for_each(iter, &dlm_domains) { | 269 | list_for_each_entry(tmp, &dlm_domains, list) { |
273 | tmp = list_entry (iter, struct dlm_ctxt, list); | ||
274 | if (strlen(tmp->name) == len && | 270 | if (strlen(tmp->name) == len && |
275 | memcmp(tmp->name, domain, len)==0) | 271 | memcmp(tmp->name, domain, len)==0) |
276 | break; | 272 | return tmp; |
277 | tmp = NULL; | ||
278 | } | 273 | } |
279 | 274 | ||
280 | return tmp; | 275 | return NULL; |
281 | } | 276 | } |
282 | 277 | ||
283 | /* For null terminated domain strings ONLY */ | 278 | /* For null terminated domain strings ONLY */ |
@@ -366,25 +361,22 @@ static void __dlm_get(struct dlm_ctxt *dlm) | |||
366 | * you shouldn't trust your pointer. */ | 361 | * you shouldn't trust your pointer. */ |
367 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm) | 362 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm) |
368 | { | 363 | { |
369 | struct list_head *iter; | 364 | struct dlm_ctxt *target; |
370 | struct dlm_ctxt *target = NULL; | 365 | struct dlm_ctxt *ret = NULL; |
371 | 366 | ||
372 | spin_lock(&dlm_domain_lock); | 367 | spin_lock(&dlm_domain_lock); |
373 | 368 | ||
374 | list_for_each(iter, &dlm_domains) { | 369 | list_for_each_entry(target, &dlm_domains, list) { |
375 | target = list_entry (iter, struct dlm_ctxt, list); | ||
376 | |||
377 | if (target == dlm) { | 370 | if (target == dlm) { |
378 | __dlm_get(target); | 371 | __dlm_get(target); |
372 | ret = target; | ||
379 | break; | 373 | break; |
380 | } | 374 | } |
381 | |||
382 | target = NULL; | ||
383 | } | 375 | } |
384 | 376 | ||
385 | spin_unlock(&dlm_domain_lock); | 377 | spin_unlock(&dlm_domain_lock); |
386 | 378 | ||
387 | return target; | 379 | return ret; |
388 | } | 380 | } |
389 | 381 | ||
390 | int dlm_domain_fully_joined(struct dlm_ctxt *dlm) | 382 | int dlm_domain_fully_joined(struct dlm_ctxt *dlm) |
@@ -2296,13 +2288,10 @@ static DECLARE_RWSEM(dlm_callback_sem); | |||
2296 | void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm, | 2288 | void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm, |
2297 | int node_num) | 2289 | int node_num) |
2298 | { | 2290 | { |
2299 | struct list_head *iter; | ||
2300 | struct dlm_eviction_cb *cb; | 2291 | struct dlm_eviction_cb *cb; |
2301 | 2292 | ||
2302 | down_read(&dlm_callback_sem); | 2293 | down_read(&dlm_callback_sem); |
2303 | list_for_each(iter, &dlm->dlm_eviction_callbacks) { | 2294 | list_for_each_entry(cb, &dlm->dlm_eviction_callbacks, ec_item) { |
2304 | cb = list_entry(iter, struct dlm_eviction_cb, ec_item); | ||
2305 | |||
2306 | cb->ec_func(node_num, cb->ec_data); | 2295 | cb->ec_func(node_num, cb->ec_data); |
2307 | } | 2296 | } |
2308 | up_read(&dlm_callback_sem); | 2297 | up_read(&dlm_callback_sem); |