Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tejun Heo and committed by
Linus Torvalds
19a101a0 ee94d523

+6 -11
+6 -11
net/9p/util.c
··· 87 87 88 88 int p9_idpool_get(struct p9_idpool *p) 89 89 { 90 - int i = 0; 91 - int error; 90 + int i; 92 91 unsigned long flags; 93 92 94 - retry: 95 - if (idr_pre_get(&p->pool, GFP_NOFS) == 0) 96 - return -1; 97 - 93 + idr_preload(GFP_NOFS); 98 94 spin_lock_irqsave(&p->lock, flags); 99 95 100 96 /* no need to store exactly p, we just need something non-null */ 101 - error = idr_get_new(&p->pool, p, &i); 102 - spin_unlock_irqrestore(&p->lock, flags); 97 + i = idr_alloc(&p->pool, p, 0, 0, GFP_NOWAIT); 103 98 104 - if (error == -EAGAIN) 105 - goto retry; 106 - else if (error) 99 + spin_unlock_irqrestore(&p->lock, flags); 100 + idr_preload_end(); 101 + if (i < 0) 107 102 return -1; 108 103 109 104 p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p);