aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-02-27ppp: convert to idr_alloc()Tejun Heo1-29/+4
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27macvtap: convert to idr_alloc()Tejun Heo1-16/+5
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Jason Wang <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27mtd: convert to idr_alloc()Tejun Heo1-7/+2
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Tested-by: Ezequiel Garcia <[email protected]> Cc: David Woodhouse <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27mmc: convert to idr_alloc()Tejun Heo1-5/+6
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Chris Ball <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27misc/tifm_core: convert to idr_alloc()Tejun Heo1-5/+6
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Alex Dubov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27misc/c2port: convert to idr_alloc()Tejun Heo1-13/+9
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Rodolfo Giometti <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27mfd: convert to idr_alloc()Tejun Heo1-7/+6
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Samuel Ortiz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27memstick: convert to idr_alloc()Tejun Heo2-25/+13
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Alex Dubov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dm: convert to idr_alloc()Tejun Heo1-39/+15
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Alasdair Kergon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/qib: convert to idr_alloc()Tejun Heo1-13/+8
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Mike Marciniszyn <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/ocrdma: convert to idr_alloc()Tejun Heo1-13/+1
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Roland Dreier <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/mlx4: convert to idr_alloc()Tejun Heo1-17/+15
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Jack Morgenstein <[email protected]> Cc: Or Gerlitz <[email protected]> Cc: Roland Dreier <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/ipath: convert to idr_alloc()Tejun Heo1-12/+4
Convert to the much saner new idr interface. [[email protected]: use GFP_NOWAIT under spin lock] Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Cc: Mike Marciniszyn <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/ehca: convert to idr_alloc()Tejun Heo2-39/+22
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Hoang-Nam Nguyen <[email protected]> Cc: Christoph Raisch <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/cxgb4: convert to idr_alloc()Tejun Heo1-13/+14
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Reviewed-by: Steve Wise <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/cxgb3: convert to idr_alloc()Tejun Heo1-13/+11
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Reviewed-by: Steve Wise <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/amso1100: convert to idr_alloc()Tejun Heo1-8/+11
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Reviewed-by: Steve Wise <[email protected]> Cc: Tom Tucker <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27IB/core: convert to idr_alloc()Tejun Heo6-81/+48
Convert to the much saner new idr interface. v2: Mike triggered WARN_ON() in idr_preload() because send_mad(), which may be used from non-process context, was calling idr_preload() unconditionally. Preload iff @gfp_mask has __GFP_WAIT. Signed-off-by: Tejun Heo <[email protected]> Reviewed-by: Sean Hefty <[email protected]> Reported-by: "Marciniszyn, Mike" <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Sean Hefty <[email protected]> Cc: Hal Rosenstock <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27i2c: convert to idr_alloc()Tejun Heo1-33/+11
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Wolfram Sang <[email protected]> Tested-by: Mark Brown <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm/vmwgfx: convert to idr_alloc()Tejun Heo1-9/+8
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm/via: convert to idr_alloc()Tejun Heo1-10/+3
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm/sis: convert to idr_alloc()Tejun Heo1-10/+3
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm/i915: convert to idr_alloc()Tejun Heo1-16/+5
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Daniel Vetter <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm/exynos: convert to idr_alloc()Tejun Heo1-11/+5
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Cc: Kukjin Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm: convert to idr_alloc()Tejun Heo4-68/+25
Convert to the much saner new idr interface. * drm_ctxbitmap_next() error handling in drm_addctx() seems broken. drm_ctxbitmap_next() return -errno on failure not -1. [[email protected]: missing idr_preload_end in drm_gem_flink_ioctl] [[email protected]: fix drm_gem_flink_ioctl() return value] Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Artem Savkov <[email protected]> Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27gpio: convert to idr_alloc()Tejun Heo1-8/+3
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Grant Likely <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27firewire: convert to idr_alloc()Tejun Heo2-17/+13
Convert to the much saner new idr interface. v2: Stefan pointed out that add_client_resource() may be called from non-process context. Preload iff @gfp_mask contains __GFP_WAIT. Also updated to include minor upper limit check. [[email protected]: fix accidentally orphaned 'minor'[ Signed-off-by: Tejun Heo <[email protected]> Acked-by: Stefan Richter <[email protected]> Signed-off-by: Tim Gardner <[email protected]> Signed-off-by: Stefan Richter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27firewire: add minor number range check to fw_device_init()Tejun Heo1-0/+4
fw_device_init() didn't check whether the allocated minor number isn't too large. Fail if it goes overflows MINORBITS. Signed-off-by: Tejun Heo <[email protected]> Suggested-by: Stefan Richter <[email protected]> Acked-by: Stefan Richter <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dmaengine: convert to idr_alloc()Tejun Heo1-10/+6
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Dan Williams <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dca: convert to idr_alloc()Tejun Heo1-13/+10
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Maciej Sosnowski <[email protected]> Cc: Shannon Nelson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drbd: convert to idr_alloc()Tejun Heo1-16/+13
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27atm/nicstar: convert to idr_alloc()Tejun Heo1-18/+6
Convert to the much saner new idr interface. The existing code looks buggy to me - ID 0 is treated as no-ID but allocation specifies 0 as lower limit and there's no error handling after partial success. This conversion keeps the bugs unchanged. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Chas Williams <[email protected]> Reported-by: kbuild test robot <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27block/loop: convert to idr_alloc()Tejun Heo1-18/+5
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27block: convert to idr_alloc()Tejun Heo2-32/+15
Convert to the much saner new idr interface. Both bsg and genhd protect idr w/ mutex making preloading unnecessary. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27block: fix synchronization and limit check in blk_alloc_devt()Tejun Heo1-8/+5
idr allocation in blk_alloc_devt() wasn't synchronized against lookup and removal, and its limit check was off by one - 1 << MINORBITS is the number of minors allowed, not the maximum allowed minor. Add locking and rename MAX_EXT_DEVT to NR_EXT_DEVT and fix limit checking. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Jens Axboe <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: implement idr_preload[_end]() and idr_alloc()Tejun Heo2-8/+180
The current idr interface is very cumbersome. * For all allocations, two function calls - idr_pre_get() and idr_get_new*() - should be made. * idr_pre_get() doesn't guarantee that the following idr_get_new*() will not fail from memory shortage. If idr_get_new*() returns -EAGAIN, the caller is expected to retry pre_get and allocation. * idr_get_new*() can't enforce upper limit. Upper limit can only be enforced by allocating and then freeing if above limit. * idr_layer buffer is unnecessarily per-idr. Each idr ends up keeping around MAX_IDR_FREE idr_layers. The memory consumed per idr is under two pages but it makes it difficult to make idr_layer larger. This patch implements the following new set of allocation functions. * idr_preload[_end]() - Similar to radix preload but doesn't fail. The first idr_alloc() inside preload section can be treated as if it were called with @gfp_mask used for idr_preload(). * idr_alloc() - Allocate an ID w/ lower and upper limits. Takes @gfp_flags and can be used w/o preloading. When used inside preloaded section, the allocation mask of preloading can be assumed. If idr_alloc() can be called from a context which allows sufficiently relaxed @gfp_mask, it can be used by itself. If, for example, idr_alloc() is called inside spinlock protected region, preloading can be used like the following. idr_preload(GFP_KERNEL); spin_lock(lock); id = idr_alloc(idr, ptr, start, end, GFP_NOWAIT); spin_unlock(lock); idr_preload_end(); if (id < 0) error; which is much simpler and less error-prone than idr_pre_get and idr_get_new*() loop. The new interface uses per-pcu idr_layer buffer and thus the number of idr's in the system doesn't affect the amount of memory used for preloading. idr_layer_alloc() is introduced to handle idr_layer allocations for both old and new ID allocation paths. This is a bit hairy now but the new interface is expected to replace the old and the internal implementation eventually will become simpler. Signed-off-by: Tejun Heo <[email protected]> Cc: Rusty Russell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: refactor idr_get_new_above()Tejun Heo1-18/+12
Move slot filling to idr_fill_slot() from idr_get_new_above_int() and make idr_get_new_above() directly call it. idr_get_new_above_int() is no longer needed and removed. This will be used to implement a new ID allocation interface. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: remove _idr_rc_to_errno() hackTejun Heo2-18/+23
idr uses -1, IDR_NEED_TO_GROW and IDR_NOMORE_SPACE to communicate exception conditions internally. The return value is later translated to errno values using _idr_rc_to_errno(). This is confusing. Drop the custom ones and consistently use -EAGAIN for "tree needs to grow", -ENOMEM for "need more memory" and -ENOSPC for "ran out of ID space". Due to the weird memory preloading mechanism, [ra]_get_new*() return -EAGAIN on memory shortage, so we need to substitute -ENOMEM w/ -EAGAIN on those interface functions. They'll eventually be cleaned up and the translations will go away. This patch doesn't introduce any functional changes. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: relocate idr_for_each_entry() and reorganize id[r|a]_get_new()Tejun Heo2-61/+35
* Move idr_for_each_entry() definition next to other idr related definitions. * Make id[r|a]_get_new() inline wrappers of id[r|a]_get_new_above(). This changes the implementation of idr_get_new() but the new implementation is trivial. This patch doesn't introduce any functional change. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: cosmetic updates to struct / initializer definitionsTejun Heo1-16/+12
* Tab align fields like a normal person. * Drop the unnecessary 0 inits from IDR_INIT(). This patch is purely cosmetic. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27idr: deprecate idr_remove_all()Tejun Heo2-8/+16
There was only one legitimate use of idr_remove_all() and a lot more of incorrect uses (or lack of it). Now that idr_destroy() implies idr_remove_all() and all the in-kernel users updated not to use it, there's no reason to keep it around. Mark it deprecated so that we can later unexport it. idr_remove_all() is made an inline function calling __idr_remove_all() to avoid triggering deprecated warning on EXPORT_SYMBOL(). Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27cgroup: don't use idr_remove_all()Tejun Heo1-3/+1
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Li Zefan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27inotify: don't use idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. Signed-off-by: Tejun Heo <[email protected]> Cc: John McCutchan <[email protected]> Cc: Robert Love <[email protected]> Cc: Eric Paris <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27nfs: idr_destroy() no longer needs idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop reference to idr_remove_all(). Note that the code wasn't completely correct before because idr_remove() on all entries doesn't necessarily release all idr_layers which could lead to memory leak. Signed-off-by: Tejun Heo <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Trond Myklebust <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dlm: don't use idr_remove_all()Tejun Heo2-2/+1
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. The conversion isn't completely trivial for recover_idr_clear() as it's the only place in kernel which makes legitimate use of idr_remove_all() w/o idr_destroy(). Replace it with idr_remove() call inside idr_for_each_entry() loop. It goes on top so that it matches the operation order in recover_idr_del(). Signed-off-by: Tejun Heo <[email protected]> Cc: Christine Caulfield <[email protected]> Cc: David Teigland <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dlm: use idr_for_each_entry() in recover_idr_clear() error pathTejun Heo1-13/+10
Convert recover_idr_clear() to use idr_for_each_entry() instead of idr_for_each(). It's somewhat less efficient this way but it shouldn't matter in an error path. This is to help with deprecation of idr_remove_all(). Signed-off-by: Tejun Heo <[email protected]> Cc: Christine Caulfield <[email protected]> Cc: David Teigland <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27rpmsg: don't use idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. Signed-off-by: Tejun Heo <[email protected]> Cc: Ohad Ben-Cohen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27remoteproc: don't use idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. Signed-off-by: Tejun Heo <[email protected]> Cc: Ohad Ben-Cohen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27dm: don't use idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. Signed-off-by: Tejun Heo <[email protected]> Cc: Alasdair Kergon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-27drm: don't use idr_remove_all()Tejun Heo7-11/+1
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. * drm_ctxbitmap_cleanup() was calling idr_remove_all() but forgetting idr_destroy() thus leaking all buffered free idr_layers. Replace it with idr_destroy(). Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Airlie <[email protected]> Cc: Inki Dae <[email protected]> Cc: Joonyoung Shim <[email protected]> Cc: Seung-Woo Kim <[email protected]> Cc: Kyungmin Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>