diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:03:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:13 -0500 |
commit | cda95406c8fe491c01b3abc422c25a613e9f36ea (patch) | |
tree | 6b9337646a9a9b1b5c90356e3fc351aeec550802 /fs/dlm | |
parent | a15abcc961426c9e560bec26785e05b68154c474 (diff) |
dlm: use idr_for_each_entry() in recover_idr_clear() error path
Convert recover_idr_clear() to use idr_for_each_entry() instead of
idr_for_each(). It's somewhat less efficient this way but it shouldn't
matter in an error path. This is to help with deprecation of
idr_remove_all().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/recover.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/dlm/recover.c b/fs/dlm/recover.c index aedea28a86a1..b2856e701641 100644 --- a/fs/dlm/recover.c +++ b/fs/dlm/recover.c | |||
@@ -351,23 +351,20 @@ static struct dlm_rsb *recover_idr_find(struct dlm_ls *ls, uint64_t id) | |||
351 | return r; | 351 | return r; |
352 | } | 352 | } |
353 | 353 | ||
354 | static int recover_idr_clear_rsb(int id, void *p, void *data) | 354 | static void recover_idr_clear(struct dlm_ls *ls) |
355 | { | 355 | { |
356 | struct dlm_ls *ls = data; | 356 | struct dlm_rsb *r; |
357 | struct dlm_rsb *r = p; | 357 | int id; |
358 | 358 | ||
359 | r->res_id = 0; | 359 | spin_lock(&ls->ls_recover_idr_lock); |
360 | r->res_recover_locks_count = 0; | ||
361 | ls->ls_recover_list_count--; | ||
362 | 360 | ||
363 | dlm_put_rsb(r); | 361 | idr_for_each_entry(&ls->ls_recover_idr, r, id) { |
364 | return 0; | 362 | r->res_id = 0; |
365 | } | 363 | r->res_recover_locks_count = 0; |
364 | ls->ls_recover_list_count--; | ||
366 | 365 | ||
367 | static void recover_idr_clear(struct dlm_ls *ls) | 366 | dlm_put_rsb(r); |
368 | { | 367 | } |
369 | spin_lock(&ls->ls_recover_idr_lock); | ||
370 | idr_for_each(&ls->ls_recover_idr, recover_idr_clear_rsb, ls); | ||
371 | idr_remove_all(&ls->ls_recover_idr); | 368 | idr_remove_all(&ls->ls_recover_idr); |
372 | 369 | ||
373 | if (ls->ls_recover_list_count != 0) { | 370 | if (ls->ls_recover_list_count != 0) { |