Messages in this thread | | | Date | Sun, 3 Feb 2013 06:28:40 -0800 | Subject | Re: [PATCH 25/62] infiniband/cxgb4: convert to idr_alloc() | From | Tejun Heo <> |
| |
Hello,
On Sun, Feb 3, 2013 at 6:18 AM, Steve Wise <swise@opengridcomputing.com> wrote: > Is there a git tree somewhere that I can use to test these patches out?
git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git convert-to-idr_alloc
>> - return ret; >> + if (lock) { >> + idr_preload(GFP_KERNEL); >> + spin_lock_irq(&rhp->lock); >> + } > > The idr_preload() needs to be above the 'if (lock)', no?
No reason to preload for ATOMIC allocation. idr_alloc() can be called by itself.
>> + >> + ret = idr_alloc(idr, handle, id, id + 1, GFP_ATOMIC); >> + >> + if (lock) { >> + spin_unlock_irq(&rhp->lock); >> + idr_preload_end(); >> + } > > And idr_preload_end() should be after the 'if (lock)' block methinks...
Ditto.
>> + >> + BUG_ON(ret == -ENOSPC); >> + return ret < 0 ? ret : 0; > > What would cause ret > 0?
It's the allocated id. In this case, ret would either be @id or -errno.
Thanks.
-- tejun
| |