diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:19 -0500 |
commit | 6b207ba3ebe7428a18878c58130e13a3e3bccef9 (patch) | |
tree | 964924c426dbf3ed16fe4a4e8e66350fa812af24 /fs/ocfs2 | |
parent | 4542da631ad210716d097aa803a0828f9fed5e87 (diff) |
ocfs2: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 0d2bf566e39a..aa88bd8bcedc 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -304,28 +304,22 @@ static u8 o2net_num_from_nn(struct o2net_node *nn) | |||
304 | 304 | ||
305 | static int o2net_prep_nsw(struct o2net_node *nn, struct o2net_status_wait *nsw) | 305 | static int o2net_prep_nsw(struct o2net_node *nn, struct o2net_status_wait *nsw) |
306 | { | 306 | { |
307 | int ret = 0; | 307 | int ret; |
308 | |||
309 | do { | ||
310 | if (!idr_pre_get(&nn->nn_status_idr, GFP_ATOMIC)) { | ||
311 | ret = -EAGAIN; | ||
312 | break; | ||
313 | } | ||
314 | spin_lock(&nn->nn_lock); | ||
315 | ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id); | ||
316 | if (ret == 0) | ||
317 | list_add_tail(&nsw->ns_node_item, | ||
318 | &nn->nn_status_list); | ||
319 | spin_unlock(&nn->nn_lock); | ||
320 | } while (ret == -EAGAIN); | ||
321 | 308 | ||
322 | if (ret == 0) { | 309 | spin_lock(&nn->nn_lock); |
323 | init_waitqueue_head(&nsw->ns_wq); | 310 | ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC); |
324 | nsw->ns_sys_status = O2NET_ERR_NONE; | 311 | if (ret >= 0) { |
325 | nsw->ns_status = 0; | 312 | nsw->ns_id = ret; |
313 | list_add_tail(&nsw->ns_node_item, &nn->nn_status_list); | ||
326 | } | 314 | } |
315 | spin_unlock(&nn->nn_lock); | ||
316 | if (ret < 0) | ||
317 | return ret; | ||
327 | 318 | ||
328 | return ret; | 319 | init_waitqueue_head(&nsw->ns_wq); |
320 | nsw->ns_sys_status = O2NET_ERR_NONE; | ||
321 | nsw->ns_status = 0; | ||
322 | return 0; | ||
329 | } | 323 | } |
330 | 324 | ||
331 | static void o2net_complete_nsw_locked(struct o2net_node *nn, | 325 | static void o2net_complete_nsw_locked(struct o2net_node *nn, |