lkml.org 
[lkml]   [2013]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 25/62] infiniband/cxgb4: convert to idr_alloc()
    From
    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


    \
     
     \ /
      Last update: 2013-02-03 16:01    [W:4.312 / U:0.560 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site