Commit 7e73eb0b authored by Matthew Wilcox's avatar Matthew Wilcox

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: default avatarMatthew Wilcox <mawilcox@microsoft.com>
parent d7b62727
...@@ -25,6 +25,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ ...@@ -25,6 +25,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o win_minmax.o earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o win_minmax.o
CFLAGS_radix-tree.o += -DCONFIG_SPARSE_RCU_POINTER CFLAGS_radix-tree.o += -DCONFIG_SPARSE_RCU_POINTER
CFLAGS_idr.o += -DCONFIG_SPARSE_RCU_POINTER
lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_MMU) += ioremap.o
lib-$(CONFIG_SMP) += cpumask.o lib-$(CONFIG_SMP) += cpumask.o
......
...@@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(simple_ida_lock); ...@@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(simple_ida_lock);
*/ */
int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp)
{ {
void **slot; void __rcu **slot;
struct radix_tree_iter iter; struct radix_tree_iter iter;
if (WARN_ON_ONCE(start < 0)) if (WARN_ON_ONCE(start < 0))
...@@ -98,7 +98,7 @@ int idr_for_each(const struct idr *idr, ...@@ -98,7 +98,7 @@ int idr_for_each(const struct idr *idr,
int (*fn)(int id, void *p, void *data), void *data) int (*fn)(int id, void *p, void *data), void *data)
{ {
struct radix_tree_iter iter; struct radix_tree_iter iter;
void **slot; void __rcu **slot;
radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) {
int ret = fn(iter.index, rcu_dereference_raw(*slot), data); int ret = fn(iter.index, rcu_dereference_raw(*slot), data);
...@@ -123,7 +123,7 @@ EXPORT_SYMBOL(idr_for_each); ...@@ -123,7 +123,7 @@ EXPORT_SYMBOL(idr_for_each);
void *idr_get_next(struct idr *idr, int *nextid) void *idr_get_next(struct idr *idr, int *nextid)
{ {
struct radix_tree_iter iter; struct radix_tree_iter iter;
void **slot; void __rcu **slot;
slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid); slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid);
if (!slot) if (!slot)
...@@ -151,7 +151,7 @@ EXPORT_SYMBOL(idr_get_next); ...@@ -151,7 +151,7 @@ EXPORT_SYMBOL(idr_get_next);
void *idr_replace(struct idr *idr, void *ptr, int id) void *idr_replace(struct idr *idr, void *ptr, int id)
{ {
struct radix_tree_node *node; struct radix_tree_node *node;
void **slot = NULL; void __rcu **slot = NULL;
void *entry; void *entry;
if (WARN_ON_ONCE(id < 0)) if (WARN_ON_ONCE(id < 0))
...@@ -250,7 +250,7 @@ EXPORT_SYMBOL(idr_replace); ...@@ -250,7 +250,7 @@ EXPORT_SYMBOL(idr_replace);
int ida_get_new_above(struct ida *ida, int start, int *id) int ida_get_new_above(struct ida *ida, int start, int *id)
{ {
struct radix_tree_root *root = &ida->ida_rt; struct radix_tree_root *root = &ida->ida_rt;
void **slot; void __rcu **slot;
struct radix_tree_iter iter; struct radix_tree_iter iter;
struct ida_bitmap *bitmap; struct ida_bitmap *bitmap;
unsigned long index; unsigned long index;
...@@ -350,7 +350,7 @@ void ida_remove(struct ida *ida, int id) ...@@ -350,7 +350,7 @@ void ida_remove(struct ida *ida, int id)
struct ida_bitmap *bitmap; struct ida_bitmap *bitmap;
unsigned long *btmp; unsigned long *btmp;
struct radix_tree_iter iter; struct radix_tree_iter iter;
void **slot; void __rcu **slot;
slot = radix_tree_iter_lookup(&ida->ida_rt, &iter, index); slot = radix_tree_iter_lookup(&ida->ida_rt, &iter, index);
if (!slot) if (!slot)
...@@ -396,7 +396,7 @@ EXPORT_SYMBOL(ida_remove); ...@@ -396,7 +396,7 @@ EXPORT_SYMBOL(ida_remove);
void ida_destroy(struct ida *ida) void ida_destroy(struct ida *ida)
{ {
struct radix_tree_iter iter; struct radix_tree_iter iter;
void **slot; void __rcu **slot;
radix_tree_for_each_slot(slot, &ida->ida_rt, &iter, 0) { radix_tree_for_each_slot(slot, &ida->ida_rt, &iter, 0) {
struct ida_bitmap *bitmap = rcu_dereference_raw(*slot); struct ida_bitmap *bitmap = rcu_dereference_raw(*slot);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment