aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/idr.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 4cf042da3892..8f4980db3524 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -49,28 +49,24 @@
49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2) 49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
50 50
51struct idr_layer { 51struct idr_layer {
52 unsigned long bitmap; /* A zero bit means "space here" */ 52 unsigned long bitmap; /* A zero bit means "space here" */
53 struct idr_layer __rcu *ary[1<<IDR_BITS]; 53 struct idr_layer __rcu *ary[1<<IDR_BITS];
54 int count; /* When zero, we can release it */ 54 int count; /* When zero, we can release it */
55 int layer; /* distance from leaf */ 55 int layer; /* distance from leaf */
56 struct rcu_head rcu_head; 56 struct rcu_head rcu_head;
57}; 57};
58 58
59struct idr { 59struct idr {
60 struct idr_layer __rcu *top; 60 struct idr_layer __rcu *top;
61 struct idr_layer *id_free; 61 struct idr_layer *id_free;
62 int layers; /* only valid without concurrent changes */ 62 int layers; /* only valid w/o concurrent changes */
63 int id_free_cnt; 63 int id_free_cnt;
64 spinlock_t lock; 64 spinlock_t lock;
65}; 65};
66 66
67#define IDR_INIT(name) \ 67#define IDR_INIT(name) \
68{ \ 68{ \
69 .top = NULL, \ 69 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70 .id_free = NULL, \
71 .layers = 0, \
72 .id_free_cnt = 0, \
73 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
74} 70}
75#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
76 72