diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 16:03:55 -0500 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 21:44:10 -0500 |
commit | 7e73eb0b2df5e8d7bd00a3c5980ab86619699963 (patch) | |
tree | 1e99281360d8f07189e71f4032ddddb52f2c8fb6 | |
parent | d7b627277b57370223d682cede979a279284b12a (diff) |
idr: Add missing __rcu annotations
Where we use the radix tree iteration macros, we need to annotate 'slot'
with __rcu. Make sure we don't forget any new places in the future with
the same CFLAGS check used for radix-tree.c.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/idr.c | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Makefile b/lib/Makefile index 2fc096985b21..43a80ec3bd10 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -25,6 +25,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
25 | earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o win_minmax.o | 25 | earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o win_minmax.o |
26 | 26 | ||
27 | CFLAGS_radix-tree.o += -DCONFIG_SPARSE_RCU_POINTER | 27 | CFLAGS_radix-tree.o += -DCONFIG_SPARSE_RCU_POINTER |
28 | CFLAGS_idr.o += -DCONFIG_SPARSE_RCU_POINTER | ||
28 | 29 | ||
29 | lib-$(CONFIG_MMU) += ioremap.o | 30 | lib-$(CONFIG_MMU) += ioremap.o |
30 | lib-$(CONFIG_SMP) += cpumask.o | 31 | lib-$(CONFIG_SMP) += cpumask.o |
@@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(simple_ida_lock); | |||
28 | */ | 28 | */ |
29 | int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) | 29 | int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) |
30 | { | 30 | { |
31 | void **slot; | 31 | void __rcu **slot; |
32 | struct radix_tree_iter iter; | 32 | struct radix_tree_iter iter; |
33 | 33 | ||
34 | if (WARN_ON_ONCE(start < 0)) | 34 | if (WARN_ON_ONCE(start < 0)) |
@@ -98,7 +98,7 @@ int idr_for_each(const struct idr *idr, | |||
98 | int (*fn)(int id, void *p, void *data), void *data) | 98 | int (*fn)(int id, void *p, void *data), void *data) |
99 | { | 99 | { |
100 | struct radix_tree_iter iter; | 100 | struct radix_tree_iter iter; |
101 | void **slot; | 101 | void __rcu **slot; |
102 | 102 | ||
103 | radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { | 103 | radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { |
104 | int ret = fn(iter.index, rcu_dereference_raw(*slot), data); | 104 | int ret = fn(iter.index, rcu_dereference_raw(*slot), data); |
@@ -123,7 +123,7 @@ EXPORT_SYMBOL(idr_for_each); | |||
123 | void *idr_get_next(struct idr *idr, int *nextid) | 123 | void *idr_get_next(struct idr *idr, int *nextid) |
124 | { | 124 | { |
125 | struct radix_tree_iter iter; | 125 | struct radix_tree_iter iter; |
126 | void **slot; | 126 | void __rcu **slot; |
127 | 127 | ||
128 | slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid); | 128 | slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid); |
129 | if (!slot) | 129 | if (!slot) |
@@ -151,7 +151,7 @@ EXPORT_SYMBOL(idr_get_next); | |||
151 | void *idr_replace(struct idr *idr, void *ptr, int id) | 151 | void *idr_replace(struct idr *idr, void *ptr, int id) |
152 | { | 152 | { |
153 | struct radix_tree_node *node; | 153 | struct radix_tree_node *node; |
154 | void **slot = NULL; | 154 | void __rcu **slot = NULL; |
155 | void *entry; | 155 | void *entry; |
156 | 156 | ||
157 | if (WARN_ON_ONCE(id < 0)) | 157 | if (WARN_ON_ONCE(id < 0)) |
@@ -250,7 +250,7 @@ EXPORT_SYMBOL(idr_replace); | |||
250 | int ida_get_new_above(struct ida *ida, int start, int *id) | 250 | int ida_get_new_above(struct ida *ida, int start, int *id) |
251 | { | 251 | { |
252 | struct radix_tree_root *root = &ida->ida_rt; | 252 | struct radix_tree_root *root = &ida->ida_rt; |
253 | void **slot; | 253 | void __rcu **slot; |
254 | struct radix_tree_iter iter; | 254 | struct radix_tree_iter iter; |
255 | struct ida_bitmap *bitmap; | 255 | struct ida_bitmap *bitmap; |
256 | unsigned long index; | 256 | unsigned long index; |
@@ -350,7 +350,7 @@ void ida_remove(struct ida *ida, int id) | |||
350 | struct ida_bitmap *bitmap; | 350 | struct ida_bitmap *bitmap; |
351 | unsigned long *btmp; | 351 | unsigned long *btmp; |
352 | struct radix_tree_iter iter; | 352 | struct radix_tree_iter iter; |
353 | void **slot; | 353 | void __rcu **slot; |
354 | 354 | ||
355 | slot = radix_tree_iter_lookup(&ida->ida_rt, &iter, index); | 355 | slot = radix_tree_iter_lookup(&ida->ida_rt, &iter, index); |
356 | if (!slot) | 356 | if (!slot) |
@@ -396,7 +396,7 @@ EXPORT_SYMBOL(ida_remove); | |||
396 | void ida_destroy(struct ida *ida) | 396 | void ida_destroy(struct ida *ida) |
397 | { | 397 | { |
398 | struct radix_tree_iter iter; | 398 | struct radix_tree_iter iter; |
399 | void **slot; | 399 | void __rcu **slot; |
400 | 400 | ||
401 | radix_tree_for_each_slot(slot, &ida->ida_rt, &iter, 0) { | 401 | radix_tree_for_each_slot(slot, &ida->ida_rt, &iter, 0) { |
402 | struct ida_bitmap *bitmap = rcu_dereference_raw(*slot); | 402 | struct ida_bitmap *bitmap = rcu_dereference_raw(*slot); |