aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 20:04:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:20 -0500
commit19a101a02ec65400233459ee7cef7037dbe8f15b (patch)
tree4166d34c37ba10d1b288a9dc037cf03c03eb3a3a /net/9p
parentee94d523bf92d3b8b2de166943d48ac7fd695e10 (diff)
net/9p: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Eric Van Hensbergen <ericvh@gmail.com> Cc: Ron Minnich <rminnich@sandia.gov> Cc: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/util.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/net/9p/util.c b/net/9p/util.c
index 6ceeeb384de7..59f278e64f58 100644
--- a/net/9p/util.c
+++ b/net/9p/util.c
@@ -87,23 +87,18 @@ EXPORT_SYMBOL(p9_idpool_destroy);
87 87
88int p9_idpool_get(struct p9_idpool *p) 88int p9_idpool_get(struct p9_idpool *p)
89{ 89{
90 int i = 0; 90 int i;
91 int error;
92 unsigned long flags; 91 unsigned long flags;
93 92
94retry: 93 idr_preload(GFP_NOFS);
95 if (idr_pre_get(&p->pool, GFP_NOFS) == 0)
96 return -1;
97
98 spin_lock_irqsave(&p->lock, flags); 94 spin_lock_irqsave(&p->lock, flags);
99 95
100 /* no need to store exactly p, we just need something non-null */ 96 /* no need to store exactly p, we just need something non-null */
101 error = idr_get_new(&p->pool, p, &i); 97 i = idr_alloc(&p->pool, p, 0, 0, GFP_NOWAIT);
102 spin_unlock_irqrestore(&p->lock, flags);
103 98
104 if (error == -EAGAIN) 99 spin_unlock_irqrestore(&p->lock, flags);
105 goto retry; 100 idr_preload_end();
106 else if (error) 101 if (i < 0)
107 return -1; 102 return -1;
108 103
109 p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p); 104 p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p);