Skip to content

Commit

Permalink
net/9p: convert to idr_alloc()
Browse files Browse the repository at this point in the history
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Eric Van Hensbergen <[email protected]>
Cc: Ron Minnich <[email protected]>
Cc: Latchesar Ionkov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 28, 2013
1 parent ee94d52 commit 19a101a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions net/9p/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,18 @@ EXPORT_SYMBOL(p9_idpool_destroy);

int p9_idpool_get(struct p9_idpool *p)
{
int i = 0;
int error;
int i;
unsigned long flags;

retry:
if (idr_pre_get(&p->pool, GFP_NOFS) == 0)
return -1;

idr_preload(GFP_NOFS);
spin_lock_irqsave(&p->lock, flags);

/* no need to store exactly p, we just need something non-null */
error = idr_get_new(&p->pool, p, &i);
spin_unlock_irqrestore(&p->lock, flags);
i = idr_alloc(&p->pool, p, 0, 0, GFP_NOWAIT);

if (error == -EAGAIN)
goto retry;
else if (error)
spin_unlock_irqrestore(&p->lock, flags);
idr_preload_end();
if (i < 0)
return -1;

p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p);
Expand Down

0 comments on commit 19a101a

Please sign in to comment.