diff options
author | Jeff Layton <[email protected]> | 2013-04-29 16:21:16 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2013-04-29 18:28:41 -0700 |
commit | 3e6628c4b347a558965041290c5a92791dd4c741 (patch) | |
tree | 7f437ed24761f467b61c0a401fc8d6a6ca7fee3a /lib/mpi/mpi-bit.c | |
parent | 27cf10e133c393f39399137b028c7b24d64ca06e (diff) |
idr: introduce idr_alloc_cyclic()
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 <[email protected]>
Reviewed-by: Tejun Heo <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: "J. Bruce Fields" <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: Jack Morgenstein <[email protected]>
Cc: John McCutchan <[email protected]>
Cc: Neil Horman <[email protected]>
Cc: Or Gerlitz <[email protected]>
Cc: Robert Love <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Sridhar Samudrala <[email protected]>
Cc: Steve Wise <[email protected]>
Cc: Tom Tucker <[email protected]>
Cc: Vlad Yasevich <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-bit.c')
0 files changed, 0 insertions, 0 deletions