diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:05:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:20 -0500 |
commit | 1d9b2e1e663719d406e3a770979a19ba4233bba0 (patch) | |
tree | 359bf3e2dce77fda66d42296992e705f0b305ea1 /include/linux/idr.h | |
parent | e8c8d1bc063bc88cfa1356266027b5075d3a82d7 (diff) |
idr: remove length restriction from idr_layer->bitmap
Currently, idr->bitmap is declared as an unsigned long which restricts
the number of bits an idr_layer can contain. All bitops can handle
arbitrary positive integer bit number and there's no reason for this
restriction.
Declare idr_layer->bitmap using DECLARE_BITMAP() instead of a single
unsigned long.
* idr_layer->bitmap is now an array. '&' dropped from params to
bitops.
* Replaced "== IDR_FULL" tests with bitmap_full() and removed
IDR_FULL.
* Replaced find_next_bit() on ~bitmap with find_next_zero_bit().
* Replaced "bitmap = 0" with bitmap_clear().
This patch doesn't (or at least shouldn't) introduce any behavior
changes.
[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r-- | include/linux/idr.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index 99b0ce533f0e..63aa542da49b 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -19,18 +19,8 @@ | |||
19 | 19 | ||
20 | #if BITS_PER_LONG == 32 | 20 | #if BITS_PER_LONG == 32 |
21 | # define IDR_BITS 5 | 21 | # define IDR_BITS 5 |
22 | # define IDR_FULL 0xfffffffful | ||
23 | /* We can only use two of the bits in the top level because there is | ||
24 | only one possible bit in the top level (5 bits * 7 levels = 35 | ||
25 | bits, but you only use 31 bits in the id). */ | ||
26 | # define TOP_LEVEL_FULL (IDR_FULL >> 30) | ||
27 | #elif BITS_PER_LONG == 64 | 22 | #elif BITS_PER_LONG == 64 |
28 | # define IDR_BITS 6 | 23 | # define IDR_BITS 6 |
29 | # define IDR_FULL 0xfffffffffffffffful | ||
30 | /* We can only use two of the bits in the top level because there is | ||
31 | only one possible bit in the top level (6 bits * 6 levels = 36 | ||
32 | bits, but you only use 31 bits in the id). */ | ||
33 | # define TOP_LEVEL_FULL (IDR_FULL >> 62) | ||
34 | #else | 24 | #else |
35 | # error "BITS_PER_LONG is not 32 or 64" | 25 | # error "BITS_PER_LONG is not 32 or 64" |
36 | #endif | 26 | #endif |
@@ -39,7 +29,7 @@ | |||
39 | #define IDR_MASK ((1 << IDR_BITS)-1) | 29 | #define IDR_MASK ((1 << IDR_BITS)-1) |
40 | 30 | ||
41 | struct idr_layer { | 31 | struct idr_layer { |
42 | unsigned long bitmap; /* A zero bit means "space here" */ | 32 | DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */ |
43 | struct idr_layer __rcu *ary[1<<IDR_BITS]; | 33 | struct idr_layer __rcu *ary[1<<IDR_BITS]; |
44 | int count; /* When zero, we can release it */ | 34 | int count; /* When zero, we can release it */ |
45 | int layer; /* distance from leaf */ | 35 | int layer; /* distance from leaf */ |