17 Oct, 2020

2 commits

  • These two functions are deprecated. Users should call ida_alloc() or
    ida_free() respectively instead. Add documentation to this effect until
    the macro can be removed.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Andrew Morton
    Reviewed-by: Tri Vo
    Cc: Greg KH
    Cc: Jonathan Corbet
    Cc: Matthew Wilcox
    Link: https://lkml.kernel.org/r/20200910055246.2297797-2-swboyd@chromium.org
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • The documentation for these functions indicates that callers don't need to
    hold a lock while calling them, but that documentation is only in one
    place under "IDA Usage". Let's state the same information on each IDA
    function so that it's clear what the calling context requires.
    Furthermore, let's document ida_simple_get() with the same information so
    that callers know how this API works.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Andrew Morton
    Reviewed-by: Greg Kroah-Hartman
    Cc: Tri Vo
    Cc: Jonathan Corbet
    Cc: Matthew Wilcox
    Link: https://lkml.kernel.org/r/20200910055246.2297797-1-swboyd@chromium.org
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     

28 May, 2020

1 commit

  • The radix-tree and idr preload mechanisms use preempt_disable() to protect
    the complete operation between xxx_preload() and xxx_preload_end().

    As the code inside the preempt disabled section acquires regular spinlocks,
    which are converted to 'sleeping' spinlocks on a PREEMPT_RT kernel and
    eventually calls into a memory allocator, this conflicts with the RT
    semantics.

    Convert it to a local_lock which allows RT kernels to substitute them with
    a real per CPU lock. On non RT kernels this maps to preempt_disable() as
    before, but provides also lockdep coverage of the critical region.
    No functional change.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Ingo Molnar
    Acked-by: Peter Zijlstra
    Link: https://lore.kernel.org/r/20200527201119.1692513-3-bigeasy@linutronix.de

    Sebastian Andrzej Siewior
     

09 Nov, 2019

1 commit

  • Pull XArray fixes from Matthew Wilcox:
    "These all fix various bugs, some of which people have tripped over and
    some of which have been caught by automatic tools"

    * tag 'xarray-5.4' of git://git.infradead.org/users/willy/linux-dax:
    idr: Fix idr_alloc_u32 on 32-bit systems
    idr: Fix integer overflow in idr_for_each_entry
    radix tree: Remove radix_tree_iter_find
    idr: Fix idr_get_next_ul race with idr_remove
    XArray: Fix xas_next() with a single entry at 0

    Linus Torvalds
     

03 Nov, 2019

1 commit

  • If there is an entry at INT_MAX then idr_for_each_entry() will increment
    id after handling it. This is undefined behaviour, and is caught by
    UBSAN. Adding 1U to id forces the operation to be carried out as an
    unsigned addition which (when assigned to id) will result in INT_MIN.
    Since there is never an entry stored at INT_MIN, idr_get_next() will
    return NULL, ending the loop as expected.

    Signed-off-by: Matthew Wilcox (Oracle)

    Matthew Wilcox (Oracle)
     

02 Jul, 2019

2 commits

  • Similarly, other callers of idr_get_next_ul() suffer the same
    overflow bug as they don't handle it properly either.

    Introduce idr_for_each_entry_continue_ul() to help these callers
    iterate from a given ID.

    cls_flower needs more care here because it still has overflow when
    does arg->cookie++, we have to fold its nested loops into one
    and remove the arg->cookie++.

    Fixes: 01683a146999 ("net: sched: refactor flower walk to iterate over idr")
    Fixes: 12d6066c3b29 ("net/mlx5: Add flow counters idr")
    Reported-by: Li Shuang
    Cc: Davide Caratti
    Cc: Vlad Buslov
    Cc: Chris Mi
    Cc: Matthew Wilcox
    Signed-off-by: Cong Wang
    Tested-by: Davide Caratti
    Signed-off-by: David S. Miller

    Cong Wang
     
  • idr_for_each_entry_ul() is buggy as it can't handle overflow
    case correctly. When we have an ID == UINT_MAX, it becomes an
    infinite loop. This happens when running on 32-bit CPU where
    unsigned long has the same size with unsigned int.

    There is no better way to fix this than casting it to a larger
    integer, but we can't just 64 bit integer on 32 bit CPU. Instead
    we could just use an additional integer to help us to detect this
    overflow case, that is, adding a new parameter to this macro.
    Fortunately tc action is its only user right now.

    Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR")
    Reported-by: Li Shuang
    Tested-by: Davide Caratti
    Cc: Matthew Wilcox
    Cc: Chris Mi
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    distributed under the gnu gpl license version 2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 1 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Reviewed-by: Steve Winslow
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171439.854676954@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 Oct, 2018

1 commit

  • Use the XA_TRACK_FREE ability to track which entries have a free bit,
    similarly to how it uses the radix tree's IDR_FREE tag. This eliminates
    the per-cpu ida_bitmap preload, and fixes the memory consumption
    regression I introduced when making the IDR able to store any pointer.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     

27 Aug, 2018

1 commit

  • Pull IDA updates from Matthew Wilcox:
    "A better IDA API:

    id = ida_alloc(ida, GFP_xxx);
    ida_free(ida, id);

    rather than the cumbersome ida_simple_get(), ida_simple_remove().

    The new IDA API is similar to ida_simple_get() but better named. The
    internal restructuring of the IDA code removes the bitmap
    preallocation nonsense.

    I hope the net -200 lines of code is convincing"

    * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits)
    ida: Change ida_get_new_above to return the id
    ida: Remove old API
    test_ida: check_ida_destroy and check_ida_alloc
    test_ida: Convert check_ida_conv to new API
    test_ida: Move ida_check_max
    test_ida: Move ida_check_leaf
    idr-test: Convert ida_check_nomem to new API
    ida: Start new test_ida module
    target/iscsi: Allocate session IDs from an IDA
    iscsi target: fix session creation failure handling
    drm/vmwgfx: Convert to new IDA API
    dmaengine: Convert to new IDA API
    ppc: Convert vas ID allocation to new IDA API
    media: Convert entity ID allocation to new IDA API
    ppc: Convert mmu context allocation to new IDA API
    Convert net_namespace to new IDA API
    cb710: Convert to new IDA API
    rsxx: Convert to new IDA API
    osd: Convert to new IDA API
    sd: Convert to new IDA API
    ...

    Linus Torvalds
     

22 Aug, 2018

2 commits

  • Delete ida_pre_get(), ida_get_new(), ida_get_new_above() and ida_remove()
    from the public API. Some of these functions still exist as internal
    helpers, but they should not be called by consumers.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • Add ida_alloc(), ida_alloc_min(), ida_alloc_max(), ida_alloc_range()
    and ida_free(). The ida_alloc_max() and ida_alloc_range() functions
    differ from ida_simple_get() in that they take an inclusive 'max'
    parameter instead of an exclusive 'end' parameter. Callers are about
    evenly split whether they'd like inclusive or exclusive parameters and
    'max' is easier to document than 'end'.

    Change the IDA allocation to first attempt to allocate a bit using
    existing memory, and only allocate memory afterwards. Also change the
    behaviour of 'min' > INT_MAX from being a BUG() to returning -ENOSPC.

    Leave compatibility wrappers in place for ida_simple_get() and
    ida_simple_remove() to avoid changing all callers.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     

19 Jun, 2018

1 commit

  • Allow users of the IDR to use the XArray lock for their own
    synchronisation purposes. The IDR continues to rely on the caller to
    handle locking, but this lets the caller use the lock embedded in the
    IDR data structure instead of allocating their own lock.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: Jason Gunthorpe

    willy@infradead.org
     

12 Apr, 2018

2 commits

  • This results in no change in structure size on 64-bit machines as it
    fits in the padding between the gfp_t and the void *. 32-bit machines
    will grow the structure from 8 to 12 bytes. Almost all radix trees are
    protected with (at least) a spinlock, so as they are converted from
    radix trees to xarrays, the data structures will shrink again.

    Initialising the spinlock requires a name for the benefit of lockdep, so
    RADIX_TREE_INIT() now needs to know the name of the radix tree it's
    initialising, and so do IDR_INIT() and IDA_INIT().

    Also add the xa_lock() and xa_unlock() family of wrappers to make it
    easier to use the lock. If we could rely on -fplan9-extensions in the
    compiler, we could avoid all of this syntactic sugar, but that wasn't
    added until gcc 4.6.

    Link: http://lkml.kernel.org/r/20180313132639.17387-8-willy@infradead.org
    Signed-off-by: Matthew Wilcox
    Reviewed-by: Jeff Layton
    Cc: Darrick J. Wong
    Cc: Dave Chinner
    Cc: Ryusuke Konishi
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     
  • Patch series "XArray", v9. (First part thereof).

    This patchset is, I believe, appropriate for merging for 4.17. It
    contains the XArray implementation, to eventually replace the radix
    tree, and converts the page cache to use it.

    This conversion keeps the radix tree and XArray data structures in sync
    at all times. That allows us to convert the page cache one function at
    a time and should allow for easier bisection. Other than renaming some
    elements of the structures, the data structures are fundamentally
    unchanged; a radix tree walk and an XArray walk will touch the same
    number of cachelines. I have changes planned to the XArray data
    structure, but those will happen in future patches.

    Improvements the XArray has over the radix tree:

    - The radix tree provides operations like other trees do; 'insert' and
    'delete'. But what most users really want is an automatically
    resizing array, and so it makes more sense to give users an API that
    is like an array -- 'load' and 'store'. We still have an 'insert'
    operation for users that really want that semantic.

    - The XArray considers locking as part of its API. This simplifies a
    lot of users who formerly had to manage their own locking just for
    the radix tree. It also improves code generation as we can now tell
    RCU that we're holding a lock and it doesn't need to generate as much
    fencing code. The other advantage is that tree nodes can be moved
    (not yet implemented).

    - GFP flags are now parameters to calls which may need to allocate
    memory. The radix tree forced users to decide what the allocation
    flags would be at creation time. It's much clearer to specify them at
    allocation time.

    - Memory is not preloaded; we don't tie up dozens of pages on the off
    chance that the slab allocator fails. Instead, we drop the lock,
    allocate a new node and retry the operation. We have to convert all
    the radix tree, IDA and IDR preload users before we can realise this
    benefit, but I have not yet found a user which cannot be converted.

    - The XArray provides a cmpxchg operation. The radix tree forces users
    to roll their own (and at least four have).

    - Iterators take a 'max' parameter. That simplifies many users and will
    reduce the amount of iteration done.

    - Iteration can proceed backwards. We only have one user for this, but
    since it's called as part of the pagefault readahead algorithm, that
    seemed worth mentioning.

    - RCU-protected pointers are not exposed as part of the API. There are
    some fun bugs where the page cache forgets to use rcu_dereference()
    in the current codebase.

    - Value entries gain an extra bit compared to radix tree exceptional
    entries. That gives us the extra bit we need to put huge page swap
    entries in the page cache.

    - Some iterators now take a 'filter' argument instead of having
    separate iterators for tagged/untagged iterations.

    The page cache is improved by this:

    - Shorter, easier to read code

    - More efficient iterations

    - Reduction in size of struct address_space

    - Fewer walks from the top of the data structure; the XArray API
    encourages staying at the leaf node and conducting operations there.

    This patch (of 8):

    None of these bits may be used for slab allocations, so we can use them
    as radix tree flags as long as we mask them off before passing them to
    the slab allocator. Move the IDR flag from the high bits to the
    GFP_ZONEMASK bits.

    Link: http://lkml.kernel.org/r/20180313132639.17387-3-willy@infradead.org
    Signed-off-by: Matthew Wilcox
    Acked-by: Jeff Layton
    Cc: Darrick J. Wong
    Cc: Dave Chinner
    Cc: Ryusuke Konishi
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

07 Feb, 2018

8 commits

  • Move the idr kernel-doc to its own idr.rst file and add a few
    paragraphs about how to use it. Also add some more kernel-doc.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • About 20% of the IDR users in the kernel want the allocated IDs to start
    at 1. The implementation currently searches all the way down the left
    hand side of the tree, finds no free ID other than ID 0, walks all the
    way back up, and then all the way down again. This patch 'rebases' the
    ID so we fill the entire radix tree, rather than leave a gap at 0.

    Chris Wilson says: "I did the quick hack of allocating index 0 of the
    idr and that eradicated idr_get_free() from being at the top of the
    profiles for the many-object stress tests. This improvement will be
    much appreciated."

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • Most places in the kernel that we need to distinguish functions by the
    type of their arguments, we use '_ul' as a suffix for the unsigned long
    variant, not '_ext'. Also add kernel-doc.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • It has no more users, so remove it. Move idr_alloc() back into idr.c,
    move the guts of idr_alloc_cmn() into idr_alloc_u32(), remove the
    wrappers around idr_get_free_cmn() and rename it to idr_get_free().
    While there is now no interface to allocate IDs larger than a u32,
    the IDR internals remain ready to handle a larger ID should a need arise.

    These changes make it possible to provide the guarantee that, if the
    nextid pointer points into the object, the object's ID will be initialised
    before a concurrent lookup can find the object.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • All current users of idr_alloc_ext() actually want to allocate a u32
    and idr_alloc_u32() fits their needs better.

    Like idr_get_next(), it uses a 'nextid' argument which serves as both
    a pointer to the start ID and the assigned ID (instead of a separate
    minimum and pointer-to-assigned-ID argument). It uses a 'max' argument
    rather than 'end' because the semantics that idr_alloc has for 'end'
    don't work well for unsigned types.

    Since idr_alloc_u32() returns an errno instead of the allocated ID, mark
    it as __must_check to help callers use it correctly. Include copious
    kernel-doc. Chris Mi has promised to contribute
    test-cases for idr_alloc_u32.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • Simply changing idr_remove's 'id' argument to 'unsigned long' works
    for all callers.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • Changing idr_replace's 'id' argument to 'unsigned long' works for all
    callers. Callers which passed a negative ID now get -ENOENT instead of
    -EINVAL. No callers relied on this error value.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • Simply changing idr_remove's 'id' argument to 'unsigned long' suffices
    for all callers.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     

15 Dec, 2017

1 commit

  • The was removed from radix-tree.h by commit f5bba9d11a25
    ("include/linux/radix-tree.h: remove unneeded #include ").

    Since that commit, tools/testing/radix-tree/ couldn't pass compilation
    due to tools/testing/radix-tree/idr.c:17: undefined reference to
    WARN_ON_ONCE. This patch adds the bug.h header to idr.h to solve the
    issue.

    Link: http://lkml.kernel.org/r/1511963726-34070-2-git-send-email-wei.w.wang@intel.com
    Fixes: f5bba9d11a2 ("include/linux/radix-tree.h: remove unneeded #include ")
    Signed-off-by: Wei Wang
    Cc: Matthew Wilcox
    Cc: Jan Kara
    Cc: Eric Biggers
    Cc: Tejun Heo
    Cc: Masahiro Yamada
    Cc: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wei Wang
     

31 Aug, 2017

1 commit

  • The following new APIs are added:

    int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
    unsigned long start, unsigned long end, gfp_t gfp);
    void *idr_remove_ext(struct idr *idr, unsigned long id);
    void *idr_find_ext(const struct idr *idr, unsigned long id);
    void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
    void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);

    Signed-off-by: Chris Mi
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Chris Mi
     

14 Feb, 2017

3 commits

  • It is a relatively common idiom (8 instances) to first look up an IDR
    entry, and then remove it from the tree if it is found, possibly doing
    further operations upon the entry afterwards. If we change idr_remove()
    to return the removed object, all of these users can save themselves a
    walk of the IDR tree.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • When we preload the IDA, we allocate an IDA bitmap. Instead of storing
    that preallocated bitmap in the IDA, we store it in a percpu variable.
    Generally there are more IDAs in the system than CPUs, so this cuts down
    on the number of preallocated bitmaps that are unused, and about half
    of the IDA users did not call ida_destroy() so they were leaking IDA
    bitmaps.

    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     
  • The IDR is very similar to the radix tree. It has some functionality that
    the radix tree did not have (alloc next free, cyclic allocation, a
    callback-based for_each, destroy tree), which is readily implementable on
    top of the radix tree. A few small changes were needed in order to use a
    tag to represent nodes with free space below them. More extensive
    changes were needed to support storing NULL as a valid entry in an IDR.
    Plain radix trees still interpret NULL as a not-present entry.

    The IDA is reimplemented as a client of the newly enhanced radix tree. As
    in the current implementation, it uses a bitmap at the last level of the
    tree.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: Matthew Wilcox
    Tested-by: Kirill A. Shutemov
    Cc: Konstantin Khlebnikov
    Cc: Ross Zwisler
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton

    Matthew Wilcox
     

15 Dec, 2016

3 commits

  • In preparation for merging the IDR and radix tree, reduce the fanout at
    each level from 256 to 64. If this causes a performance problem then a
    bisect will point to this commit, and we'll have a better idea about
    what we might do to fix it.

    Link: http://lkml.kernel.org/r/1480369871-5271-66-git-send-email-mawilcox@linuxonhyperv.com
    Signed-off-by: Matthew Wilcox
    Tested-by: Kirill A. Shutemov
    Cc: Konstantin Khlebnikov
    Cc: Ross Zwisler
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     
  • Add idr_get_cursor() / idr_set_cursor() APIs, and remove the reference
    to IDR_SIZE.

    Link: http://lkml.kernel.org/r/1480369871-5271-65-git-send-email-mawilcox@linuxonhyperv.com
    Signed-off-by: Matthew Wilcox
    Reviewed-by: David Howells
    Tested-by: Kirill A. Shutemov
    Cc: Konstantin Khlebnikov
    Cc: Ross Zwisler
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     
  • Two of the USB Gadgets were poking around in the internals of struct ida
    in order to determine if it is empty. Add the appropriate abstraction.

    Link: http://lkml.kernel.org/r/1480369871-5271-63-git-send-email-mawilcox@linuxonhyperv.com
    Signed-off-by: Matthew Wilcox
    Acked-by: Konstantin Khlebnikov
    Tested-by: Kirill A. Shutemov
    Cc: Ross Zwisler
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Michal Nazarewicz
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

26 Nov, 2015

1 commit

  • The status command originates the drbd9 code base. While for now we
    keep the status information in /proc/drbd available, this commit
    allows the user base to gracefully migrate their monitoring
    infrastructure to the new status reporting interface.

    In drbd9 no status information is exposed through /proc/drbd.

    Signed-off-by: Philipp Reisner
    Signed-off-by: Lars Ellenberg
    Signed-off-by: Jens Axboe

    Andreas Gruenbacher
     

07 Jun, 2014

1 commit

  • idr_layer->layer is always accessed in read path, move it in the front.

    idr_layer->bitmap is moved on the bottom. And rcu_head shares with
    bitmap due to they do not be accessed at the same time.

    idr->id_free/id_free_cnt/lock are free list fields, and moved to the
    bottom. They will be removed in near future.

    Signed-off-by: Lai Jiangshan
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lai Jiangshan
     

08 Apr, 2014

1 commit

  • Remove no longer used deprecated code, and make local functions
    static.

    Signed-off-by: Stephen Hemminger
    Acked-by: Jean Delvare
    Acked-by: Tejun Heo
    Cc: Jeff Layton
    Cc: Philipp Reisner
    Cc: Jens Axboe
    Cc: George Spelvin
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Hemminger
     

03 Apr, 2014

1 commit

  • Pull trivial tree updates from Jiri Kosina:
    "Usual rocket science -- mostly documentation and comment updates"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    sparse: fix comment
    doc: fix double words
    isdn: capi: fix "CAPI_VERSION" comment
    doc: DocBook: Fix typos in xml and template file
    Bluetooth: add module name for btwilink
    driver core: unexport static function create_syslog_header
    mmc: core: typo fix in printk specifier
    ARM: spear: clean up editing mistake
    net-sysfs: fix comment typo 'CONFIG_SYFS'
    doc: Insert MODULE_ in module-signing macros
    Documentation: update URL to hfsplus Technote 1150
    gpio: update path to documentation
    ixgbe: Fix format string in ixgbe_fcoe.
    Kconfig: Remove useless "default N" lines
    user_namespace.c: Remove duplicated word in comment
    CREDITS: fix formatting
    treewide: Fix typo in Documentation/DocBook
    mm: Fix warning on make htmldocs caused by slab.c
    ata: ata-samsung_cf: cleanup in header file
    idr: remove unused prototype of idr_free()

    Linus Torvalds
     

17 Feb, 2014

1 commit


31 Jan, 2014

1 commit


09 May, 2013

1 commit

  • Pull block driver updates from Jens Axboe:
    "It might look big in volume, but when categorized, not a lot of
    drivers are touched. The pull request contains:

    - mtip32xx fixes from Micron.

    - A slew of drbd updates, this time in a nicer series.

    - bcache, a flash/ssd caching framework from Kent.

    - Fixes for cciss"

    * 'for-3.10/drivers' of git://git.kernel.dk/linux-block: (66 commits)
    bcache: Use bd_link_disk_holder()
    bcache: Allocator cleanup/fixes
    cciss: bug fix to prevent cciss from loading in kdump crash kernel
    cciss: add cciss_allow_hpsa module parameter
    drivers/block/mg_disk.c: add CONFIG_PM_SLEEP to suspend/resume functions
    mtip32xx: Workaround for unaligned writes
    bcache: Make sure blocksize isn't smaller than device blocksize
    bcache: Fix merge_bvec_fn usage for when it modifies the bvm
    bcache: Correctly check against BIO_MAX_PAGES
    bcache: Hack around stuff that clones up to bi_max_vecs
    bcache: Set ra_pages based on backing device's ra_pages
    bcache: Take data offset from the bdev superblock.
    mtip32xx: mtip32xx: Disable TRIM support
    mtip32xx: fix a smatch warning
    bcache: Disable broken btree fuzz tester
    bcache: Fix a format string overflow
    bcache: Fix a minor memory leak on device teardown
    bcache: Documentation updates
    bcache: Use WARN_ONCE() instead of __WARN()
    bcache: Add missing #include
    ...

    Linus Torvalds
     

30 Apr, 2013

1 commit

  • As Tejun points out, there are several users of the IDR facility that
    attempt to use it in a cyclic fashion. These users are likely to see
    -ENOSPC errors after the counter wraps one or more times however.

    This patchset adds a new idr_alloc_cyclic routine and converts several
    of these users to it. Many of these users are in obscure parts of the
    kernel, and I don't have a good way to test some of them. The change is
    pretty straightforward though, so hopefully it won't be an issue.

    There is one other cyclic user of idr_alloc that I didn't touch in
    ipc/util.c. That one is doing some strange stuff that I didn't quite
    understand, but it looks like it should probably be converted later
    somehow.

    This patch:

    Thus spake Tejun Heo:

    Ooh, BTW, the cyclic allocation is broken. It's prone to -ENOSPC
    after the first wraparound. There are several cyclic users in the
    kernel and I think it probably would be best to implement cyclic
    support in idr.

    This patch does that by adding new idr_alloc_cyclic function that such
    users in the kernel can use. With this, there's no need for a caller to
    keep track of the last value used as that's now tracked internally. This
    should prevent the ENOSPC problems that can hit when the "last allocated"
    counter exceeds INT_MAX.

    Later patches will convert existing cyclic users to the new interface.

    Signed-off-by: Jeff Layton
    Reviewed-by: Tejun Heo
    Cc: "David S. Miller"
    Cc: "J. Bruce Fields"
    Cc: Eric Paris
    Cc: Jack Morgenstein
    Cc: John McCutchan
    Cc: Neil Horman
    Cc: Or Gerlitz
    Cc: Robert Love
    Cc: Roland Dreier
    Cc: Sridhar Samudrala
    Cc: Steve Wise
    Cc: Tom Tucker
    Cc: Vlad Yasevich

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Layton
     

29 Mar, 2013

1 commit