diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 15:58:24 -0500 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 21:44:09 -0500 |
commit | d7b627277b57370223d682cede979a279284b12a (patch) | |
tree | 33d769656f0dcf554fbe882545de71de791ee060 | |
parent | 12320d0ff1c9d5582f5c35e4bb8b9c70c475fd71 (diff) |
radix-tree: Fix __rcu annotations
Many places were missing __rcu annotations. A few places needed a few
lines of explanation about why it was safe to not use RCU accessors.
Add a custom CFLAGS setting to the Makefile to ensure that new patches
don't miss RCU annotations.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
-rw-r--r-- | include/linux/radix-tree.h | 110 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/radix-tree.c | 125 |
3 files changed, 122 insertions, 115 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 0b502de7d23a..3e5735064b71 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -221,10 +221,8 @@ static inline unsigned int iter_shift(const struct radix_tree_iter *iter) | |||
221 | */ | 221 | */ |
222 | 222 | ||
223 | /** | 223 | /** |
224 | * radix_tree_deref_slot - dereference a slot | 224 | * radix_tree_deref_slot - dereference a slot |
225 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot | 225 | * @slot: slot pointer, returned by radix_tree_lookup_slot |
226 | * Returns: item that was stored in that slot with any direct pointer flag | ||
227 | * removed. | ||
228 | * | 226 | * |
229 | * For use with radix_tree_lookup_slot(). Caller must hold tree at least read | 227 | * For use with radix_tree_lookup_slot(). Caller must hold tree at least read |
230 | * locked across slot lookup and dereference. Not required if write lock is | 228 | * locked across slot lookup and dereference. Not required if write lock is |
@@ -232,26 +230,27 @@ static inline unsigned int iter_shift(const struct radix_tree_iter *iter) | |||
232 | * | 230 | * |
233 | * radix_tree_deref_retry must be used to confirm validity of the pointer if | 231 | * radix_tree_deref_retry must be used to confirm validity of the pointer if |
234 | * only the read lock is held. | 232 | * only the read lock is held. |
233 | * | ||
234 | * Return: entry stored in that slot. | ||
235 | */ | 235 | */ |
236 | static inline void *radix_tree_deref_slot(void **pslot) | 236 | static inline void *radix_tree_deref_slot(void __rcu **slot) |
237 | { | 237 | { |
238 | return rcu_dereference(*pslot); | 238 | return rcu_dereference(*slot); |
239 | } | 239 | } |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held | 242 | * radix_tree_deref_slot_protected - dereference a slot with tree lock held |
243 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot | 243 | * @slot: slot pointer, returned by radix_tree_lookup_slot |
244 | * Returns: item that was stored in that slot with any direct pointer flag | 244 | * |
245 | * removed. | 245 | * Similar to radix_tree_deref_slot. The caller does not hold the RCU read |
246 | * | 246 | * lock but it must hold the tree lock to prevent parallel updates. |
247 | * Similar to radix_tree_deref_slot but only used during migration when a pages | 247 | * |
248 | * mapping is being moved. The caller does not hold the RCU read lock but it | 248 | * Return: entry stored in that slot. |
249 | * must hold the tree lock to prevent parallel updates. | ||
250 | */ | 249 | */ |
251 | static inline void *radix_tree_deref_slot_protected(void **pslot, | 250 | static inline void *radix_tree_deref_slot_protected(void __rcu **slot, |
252 | spinlock_t *treelock) | 251 | spinlock_t *treelock) |
253 | { | 252 | { |
254 | return rcu_dereference_protected(*pslot, lockdep_is_held(treelock)); | 253 | return rcu_dereference_protected(*slot, lockdep_is_held(treelock)); |
255 | } | 254 | } |
256 | 255 | ||
257 | /** | 256 | /** |
@@ -287,9 +286,9 @@ static inline int radix_tree_exception(void *arg) | |||
287 | return unlikely((unsigned long)arg & RADIX_TREE_ENTRY_MASK); | 286 | return unlikely((unsigned long)arg & RADIX_TREE_ENTRY_MASK); |
288 | } | 287 | } |
289 | 288 | ||
290 | int __radix_tree_create(struct radix_tree_root *root, unsigned long index, | 289 | int __radix_tree_create(struct radix_tree_root *, unsigned long index, |
291 | unsigned order, struct radix_tree_node **nodep, | 290 | unsigned order, struct radix_tree_node **nodep, |
292 | void ***slotp); | 291 | void __rcu ***slotp); |
293 | int __radix_tree_insert(struct radix_tree_root *, unsigned long index, | 292 | int __radix_tree_insert(struct radix_tree_root *, unsigned long index, |
294 | unsigned order, void *); | 293 | unsigned order, void *); |
295 | static inline int radix_tree_insert(struct radix_tree_root *root, | 294 | static inline int radix_tree_insert(struct radix_tree_root *root, |
@@ -298,42 +297,41 @@ static inline int radix_tree_insert(struct radix_tree_root *root, | |||
298 | return __radix_tree_insert(root, index, 0, entry); | 297 | return __radix_tree_insert(root, index, 0, entry); |
299 | } | 298 | } |
300 | void *__radix_tree_lookup(const struct radix_tree_root *, unsigned long index, | 299 | void *__radix_tree_lookup(const struct radix_tree_root *, unsigned long index, |
301 | struct radix_tree_node **nodep, void ***slotp); | 300 | struct radix_tree_node **nodep, void __rcu ***slotp); |
302 | void *radix_tree_lookup(const struct radix_tree_root *, unsigned long); | 301 | void *radix_tree_lookup(const struct radix_tree_root *, unsigned long); |
303 | void **radix_tree_lookup_slot(const struct radix_tree_root *, unsigned long); | 302 | void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *, |
303 | unsigned long index); | ||
304 | typedef void (*radix_tree_update_node_t)(struct radix_tree_node *, void *); | 304 | typedef void (*radix_tree_update_node_t)(struct radix_tree_node *, void *); |
305 | void __radix_tree_replace(struct radix_tree_root *root, | 305 | void __radix_tree_replace(struct radix_tree_root *, struct radix_tree_node *, |
306 | struct radix_tree_node *node, | 306 | void __rcu **slot, void *entry, |
307 | void **slot, void *item, | ||
308 | radix_tree_update_node_t update_node, void *private); | 307 | radix_tree_update_node_t update_node, void *private); |
309 | void radix_tree_iter_replace(struct radix_tree_root *, | 308 | void radix_tree_iter_replace(struct radix_tree_root *, |
310 | const struct radix_tree_iter *, void **slot, void *item); | 309 | const struct radix_tree_iter *, void __rcu **slot, void *entry); |
311 | void radix_tree_replace_slot(struct radix_tree_root *root, | 310 | void radix_tree_replace_slot(struct radix_tree_root *, |
312 | void **slot, void *item); | 311 | void __rcu **slot, void *entry); |
313 | void __radix_tree_delete_node(struct radix_tree_root *root, | 312 | void __radix_tree_delete_node(struct radix_tree_root *, |
314 | struct radix_tree_node *node, | 313 | struct radix_tree_node *, |
315 | radix_tree_update_node_t update_node, | 314 | radix_tree_update_node_t update_node, |
316 | void *private); | 315 | void *private); |
317 | void radix_tree_iter_delete(struct radix_tree_root *, | 316 | void radix_tree_iter_delete(struct radix_tree_root *, |
318 | struct radix_tree_iter *iter, void **slot); | 317 | struct radix_tree_iter *iter, void __rcu **slot); |
319 | void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); | 318 | void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *); |
320 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); | 319 | void *radix_tree_delete(struct radix_tree_root *, unsigned long); |
321 | void radix_tree_clear_tags(struct radix_tree_root *root, | 320 | void radix_tree_clear_tags(struct radix_tree_root *, struct radix_tree_node *, |
322 | struct radix_tree_node *node, | 321 | void __rcu **slot); |
323 | void **slot); | ||
324 | unsigned int radix_tree_gang_lookup(const struct radix_tree_root *, | 322 | unsigned int radix_tree_gang_lookup(const struct radix_tree_root *, |
325 | void **results, unsigned long first_index, | 323 | void **results, unsigned long first_index, |
326 | unsigned int max_items); | 324 | unsigned int max_items); |
327 | unsigned int radix_tree_gang_lookup_slot(const struct radix_tree_root *, | 325 | unsigned int radix_tree_gang_lookup_slot(const struct radix_tree_root *, |
328 | void ***results, unsigned long *indices, | 326 | void __rcu ***results, unsigned long *indices, |
329 | unsigned long first_index, unsigned int max_items); | 327 | unsigned long first_index, unsigned int max_items); |
330 | int radix_tree_preload(gfp_t gfp_mask); | 328 | int radix_tree_preload(gfp_t gfp_mask); |
331 | int radix_tree_maybe_preload(gfp_t gfp_mask); | 329 | int radix_tree_maybe_preload(gfp_t gfp_mask); |
332 | int radix_tree_maybe_preload_order(gfp_t gfp_mask, int order); | 330 | int radix_tree_maybe_preload_order(gfp_t gfp_mask, int order); |
333 | void radix_tree_init(void); | 331 | void radix_tree_init(void); |
334 | void *radix_tree_tag_set(struct radix_tree_root *root, | 332 | void *radix_tree_tag_set(struct radix_tree_root *, |
335 | unsigned long index, unsigned int tag); | 333 | unsigned long index, unsigned int tag); |
336 | void *radix_tree_tag_clear(struct radix_tree_root *root, | 334 | void *radix_tree_tag_clear(struct radix_tree_root *, |
337 | unsigned long index, unsigned int tag); | 335 | unsigned long index, unsigned int tag); |
338 | int radix_tree_tag_get(const struct radix_tree_root *, | 336 | int radix_tree_tag_get(const struct radix_tree_root *, |
339 | unsigned long index, unsigned int tag); | 337 | unsigned long index, unsigned int tag); |
@@ -341,15 +339,13 @@ void radix_tree_iter_tag_set(struct radix_tree_root *, | |||
341 | const struct radix_tree_iter *iter, unsigned int tag); | 339 | const struct radix_tree_iter *iter, unsigned int tag); |
342 | void radix_tree_iter_tag_clear(struct radix_tree_root *, | 340 | void radix_tree_iter_tag_clear(struct radix_tree_root *, |
343 | const struct radix_tree_iter *iter, unsigned int tag); | 341 | const struct radix_tree_iter *iter, unsigned int tag); |
344 | unsigned int | 342 | unsigned int radix_tree_gang_lookup_tag(const struct radix_tree_root *, |
345 | radix_tree_gang_lookup_tag(const struct radix_tree_root *, void **results, | 343 | void **results, unsigned long first_index, |
346 | unsigned long first_index, unsigned int max_items, | 344 | unsigned int max_items, unsigned int tag); |
347 | unsigned int tag); | 345 | unsigned int radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *, |
348 | unsigned int | 346 | void __rcu ***results, unsigned long first_index, |
349 | radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *, void ***results, | 347 | unsigned int max_items, unsigned int tag); |
350 | unsigned long first_index, unsigned int max_items, | 348 | int radix_tree_tagged(const struct radix_tree_root *, unsigned int tag); |
351 | unsigned int tag); | ||
352 | int radix_tree_tagged(const struct radix_tree_root *root, unsigned int tag); | ||
353 | 349 | ||
354 | static inline void radix_tree_preload_end(void) | 350 | static inline void radix_tree_preload_end(void) |
355 | { | 351 | { |
@@ -361,7 +357,7 @@ int radix_tree_split(struct radix_tree_root *, unsigned long index, | |||
361 | unsigned new_order); | 357 | unsigned new_order); |
362 | int radix_tree_join(struct radix_tree_root *, unsigned long index, | 358 | int radix_tree_join(struct radix_tree_root *, unsigned long index, |
363 | unsigned new_order, void *); | 359 | unsigned new_order, void *); |
364 | void **idr_get_free(struct radix_tree_root *, struct radix_tree_iter *, | 360 | void __rcu **idr_get_free(struct radix_tree_root *, struct radix_tree_iter *, |
365 | gfp_t, int end); | 361 | gfp_t, int end); |
366 | 362 | ||
367 | enum { | 363 | enum { |
@@ -377,7 +373,7 @@ enum { | |||
377 | * @start: iteration starting index | 373 | * @start: iteration starting index |
378 | * Returns: NULL | 374 | * Returns: NULL |
379 | */ | 375 | */ |
380 | static __always_inline void ** | 376 | static __always_inline void __rcu ** |
381 | radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start) | 377 | radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start) |
382 | { | 378 | { |
383 | /* | 379 | /* |
@@ -406,7 +402,7 @@ radix_tree_iter_init(struct radix_tree_iter *iter, unsigned long start) | |||
406 | * Also it fills @iter with data about chunk: position in the tree (index), | 402 | * Also it fills @iter with data about chunk: position in the tree (index), |
407 | * its end (next_index), and constructs a bit mask for tagged iterating (tags). | 403 | * its end (next_index), and constructs a bit mask for tagged iterating (tags). |
408 | */ | 404 | */ |
409 | void **radix_tree_next_chunk(const struct radix_tree_root *, | 405 | void __rcu **radix_tree_next_chunk(const struct radix_tree_root *, |
410 | struct radix_tree_iter *iter, unsigned flags); | 406 | struct radix_tree_iter *iter, unsigned flags); |
411 | 407 | ||
412 | /** | 408 | /** |
@@ -419,7 +415,8 @@ void **radix_tree_next_chunk(const struct radix_tree_root *, | |||
419 | * containing it and updates @iter to describe the entry. If @index is not | 415 | * containing it and updates @iter to describe the entry. If @index is not |
420 | * present, it returns NULL. | 416 | * present, it returns NULL. |
421 | */ | 417 | */ |
422 | static inline void **radix_tree_iter_lookup(const struct radix_tree_root *root, | 418 | static inline void __rcu ** |
419 | radix_tree_iter_lookup(const struct radix_tree_root *root, | ||
423 | struct radix_tree_iter *iter, unsigned long index) | 420 | struct radix_tree_iter *iter, unsigned long index) |
424 | { | 421 | { |
425 | radix_tree_iter_init(iter, index); | 422 | radix_tree_iter_init(iter, index); |
@@ -436,7 +433,8 @@ static inline void **radix_tree_iter_lookup(const struct radix_tree_root *root, | |||
436 | * which is at least @index. If @index is larger than any present entry, this | 433 | * which is at least @index. If @index is larger than any present entry, this |
437 | * function returns NULL. The @iter is updated to describe the entry found. | 434 | * function returns NULL. The @iter is updated to describe the entry found. |
438 | */ | 435 | */ |
439 | static inline void **radix_tree_iter_find(const struct radix_tree_root *root, | 436 | static inline void __rcu ** |
437 | radix_tree_iter_find(const struct radix_tree_root *root, | ||
440 | struct radix_tree_iter *iter, unsigned long index) | 438 | struct radix_tree_iter *iter, unsigned long index) |
441 | { | 439 | { |
442 | radix_tree_iter_init(iter, index); | 440 | radix_tree_iter_init(iter, index); |
@@ -453,7 +451,7 @@ static inline void **radix_tree_iter_find(const struct radix_tree_root *root, | |||
453 | * and continue the iteration. | 451 | * and continue the iteration. |
454 | */ | 452 | */ |
455 | static inline __must_check | 453 | static inline __must_check |
456 | void **radix_tree_iter_retry(struct radix_tree_iter *iter) | 454 | void __rcu **radix_tree_iter_retry(struct radix_tree_iter *iter) |
457 | { | 455 | { |
458 | iter->next_index = iter->index; | 456 | iter->next_index = iter->index; |
459 | iter->tags = 0; | 457 | iter->tags = 0; |
@@ -476,7 +474,7 @@ __radix_tree_iter_add(struct radix_tree_iter *iter, unsigned long slots) | |||
476 | * have been invalidated by an insertion or deletion. Call this function | 474 | * have been invalidated by an insertion or deletion. Call this function |
477 | * before releasing the lock to continue the iteration from the next index. | 475 | * before releasing the lock to continue the iteration from the next index. |
478 | */ | 476 | */ |
479 | void **__must_check radix_tree_iter_resume(void **slot, | 477 | void __rcu **__must_check radix_tree_iter_resume(void __rcu **slot, |
480 | struct radix_tree_iter *iter); | 478 | struct radix_tree_iter *iter); |
481 | 479 | ||
482 | /** | 480 | /** |
@@ -492,11 +490,11 @@ radix_tree_chunk_size(struct radix_tree_iter *iter) | |||
492 | } | 490 | } |
493 | 491 | ||
494 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 492 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
495 | void ** __radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, | 493 | void __rcu **__radix_tree_next_slot(void __rcu **slot, |
496 | unsigned flags); | 494 | struct radix_tree_iter *iter, unsigned flags); |
497 | #else | 495 | #else |
498 | /* Can't happen without sibling entries, but the compiler can't tell that */ | 496 | /* Can't happen without sibling entries, but the compiler can't tell that */ |
499 | static inline void ** __radix_tree_next_slot(void **slot, | 497 | static inline void __rcu **__radix_tree_next_slot(void __rcu **slot, |
500 | struct radix_tree_iter *iter, unsigned flags) | 498 | struct radix_tree_iter *iter, unsigned flags) |
501 | { | 499 | { |
502 | return slot; | 500 | return slot; |
@@ -522,8 +520,8 @@ static inline void ** __radix_tree_next_slot(void **slot, | |||
522 | * b) we are doing non-tagged iteration, and iter->index and iter->next_index | 520 | * b) we are doing non-tagged iteration, and iter->index and iter->next_index |
523 | * have been set up so that radix_tree_chunk_size() returns 1 or 0. | 521 | * have been set up so that radix_tree_chunk_size() returns 1 or 0. |
524 | */ | 522 | */ |
525 | static __always_inline void ** | 523 | static __always_inline void __rcu **radix_tree_next_slot(void __rcu **slot, |
526 | radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) | 524 | struct radix_tree_iter *iter, unsigned flags) |
527 | { | 525 | { |
528 | if (flags & RADIX_TREE_ITER_TAGGED) { | 526 | if (flags & RADIX_TREE_ITER_TAGGED) { |
529 | iter->tags >>= 1; | 527 | iter->tags >>= 1; |
diff --git a/lib/Makefile b/lib/Makefile index bc4073a8cd08..2fc096985b21 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -24,6 +24,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
24 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ | 24 | is_single_threaded.o plist.o decompress.o kobject_uevent.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 | ||
28 | |||
27 | lib-$(CONFIG_MMU) += ioremap.o | 29 | lib-$(CONFIG_MMU) += ioremap.o |
28 | lib-$(CONFIG_SMP) += cpumask.o | 30 | lib-$(CONFIG_SMP) += cpumask.o |
29 | lib-$(CONFIG_HAS_DMA) += dma-noop.o | 31 | lib-$(CONFIG_HAS_DMA) += dma-noop.o |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 723bebe40eef..9c0fa4df736b 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -104,7 +104,7 @@ static inline void *node_to_entry(void *ptr) | |||
104 | static inline | 104 | static inline |
105 | bool is_sibling_entry(const struct radix_tree_node *parent, void *node) | 105 | bool is_sibling_entry(const struct radix_tree_node *parent, void *node) |
106 | { | 106 | { |
107 | void **ptr = node; | 107 | void __rcu **ptr = node; |
108 | return (parent->slots <= ptr) && | 108 | return (parent->slots <= ptr) && |
109 | (ptr < parent->slots + RADIX_TREE_MAP_SIZE); | 109 | (ptr < parent->slots + RADIX_TREE_MAP_SIZE); |
110 | } | 110 | } |
@@ -116,8 +116,8 @@ bool is_sibling_entry(const struct radix_tree_node *parent, void *node) | |||
116 | } | 116 | } |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | static inline | 119 | static inline unsigned long |
120 | unsigned long get_slot_offset(const struct radix_tree_node *parent, void **slot) | 120 | get_slot_offset(const struct radix_tree_node *parent, void __rcu **slot) |
121 | { | 121 | { |
122 | return slot - parent->slots; | 122 | return slot - parent->slots; |
123 | } | 123 | } |
@@ -126,12 +126,13 @@ static unsigned int radix_tree_descend(const struct radix_tree_node *parent, | |||
126 | struct radix_tree_node **nodep, unsigned long index) | 126 | struct radix_tree_node **nodep, unsigned long index) |
127 | { | 127 | { |
128 | unsigned int offset = (index >> parent->shift) & RADIX_TREE_MAP_MASK; | 128 | unsigned int offset = (index >> parent->shift) & RADIX_TREE_MAP_MASK; |
129 | void **entry = rcu_dereference_raw(parent->slots[offset]); | 129 | void __rcu **entry = rcu_dereference_raw(parent->slots[offset]); |
130 | 130 | ||
131 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 131 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
132 | if (radix_tree_is_internal_node(entry)) { | 132 | if (radix_tree_is_internal_node(entry)) { |
133 | if (is_sibling_entry(parent, entry)) { | 133 | if (is_sibling_entry(parent, entry)) { |
134 | void **sibentry = (void **) entry_to_node(entry); | 134 | void __rcu **sibentry; |
135 | sibentry = (void __rcu **) entry_to_node(entry); | ||
135 | offset = get_slot_offset(parent, sibentry); | 136 | offset = get_slot_offset(parent, sibentry); |
136 | entry = rcu_dereference_raw(*sibentry); | 137 | entry = rcu_dereference_raw(*sibentry); |
137 | } | 138 | } |
@@ -618,7 +619,7 @@ static unsigned radix_tree_load_root(const struct radix_tree_root *root, | |||
618 | static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, | 619 | static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, |
619 | unsigned long index, unsigned int shift) | 620 | unsigned long index, unsigned int shift) |
620 | { | 621 | { |
621 | struct radix_tree_node *slot; | 622 | void *entry; |
622 | unsigned int maxshift; | 623 | unsigned int maxshift; |
623 | int tag; | 624 | int tag; |
624 | 625 | ||
@@ -627,8 +628,8 @@ static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, | |||
627 | while (index > shift_maxindex(maxshift)) | 628 | while (index > shift_maxindex(maxshift)) |
628 | maxshift += RADIX_TREE_MAP_SHIFT; | 629 | maxshift += RADIX_TREE_MAP_SHIFT; |
629 | 630 | ||
630 | slot = rcu_dereference_raw(root->rnode); | 631 | entry = rcu_dereference_raw(root->rnode); |
631 | if (!slot && (!is_idr(root) || root_tag_get(root, IDR_FREE))) | 632 | if (!entry && (!is_idr(root) || root_tag_get(root, IDR_FREE))) |
632 | goto out; | 633 | goto out; |
633 | 634 | ||
634 | do { | 635 | do { |
@@ -652,15 +653,19 @@ static int radix_tree_extend(struct radix_tree_root *root, gfp_t gfp, | |||
652 | } | 653 | } |
653 | 654 | ||
654 | BUG_ON(shift > BITS_PER_LONG); | 655 | BUG_ON(shift > BITS_PER_LONG); |
655 | if (radix_tree_is_internal_node(slot)) { | 656 | if (radix_tree_is_internal_node(entry)) { |
656 | entry_to_node(slot)->parent = node; | 657 | entry_to_node(entry)->parent = node; |
657 | } else if (radix_tree_exceptional_entry(slot)) { | 658 | } else if (radix_tree_exceptional_entry(entry)) { |
658 | /* Moving an exceptional root->rnode to a node */ | 659 | /* Moving an exceptional root->rnode to a node */ |
659 | node->exceptional = 1; | 660 | node->exceptional = 1; |
660 | } | 661 | } |
661 | node->slots[0] = slot; | 662 | /* |
662 | slot = node_to_entry(node); | 663 | * entry was already in the radix tree, so we do not need |
663 | rcu_assign_pointer(root->rnode, slot); | 664 | * rcu_assign_pointer here |
665 | */ | ||
666 | node->slots[0] = (void __rcu *)entry; | ||
667 | entry = node_to_entry(node); | ||
668 | rcu_assign_pointer(root->rnode, entry); | ||
664 | shift += RADIX_TREE_MAP_SHIFT; | 669 | shift += RADIX_TREE_MAP_SHIFT; |
665 | } while (shift <= maxshift); | 670 | } while (shift <= maxshift); |
666 | out: | 671 | out: |
@@ -708,7 +713,7 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root, | |||
708 | * (node->slots[0]), it will be safe to dereference the new | 713 | * (node->slots[0]), it will be safe to dereference the new |
709 | * one (root->rnode) as far as dependent read barriers go. | 714 | * one (root->rnode) as far as dependent read barriers go. |
710 | */ | 715 | */ |
711 | root->rnode = child; | 716 | root->rnode = (void __rcu *)child; |
712 | if (is_idr(root) && !tag_get(node, IDR_FREE, 0)) | 717 | if (is_idr(root) && !tag_get(node, IDR_FREE, 0)) |
713 | root_tag_clear(root, IDR_FREE); | 718 | root_tag_clear(root, IDR_FREE); |
714 | 719 | ||
@@ -732,7 +737,7 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root, | |||
732 | */ | 737 | */ |
733 | node->count = 0; | 738 | node->count = 0; |
734 | if (!radix_tree_is_internal_node(child)) { | 739 | if (!radix_tree_is_internal_node(child)) { |
735 | node->slots[0] = RADIX_TREE_RETRY; | 740 | node->slots[0] = (void __rcu *)RADIX_TREE_RETRY; |
736 | if (update_node) | 741 | if (update_node) |
737 | update_node(node, private); | 742 | update_node(node, private); |
738 | } | 743 | } |
@@ -805,10 +810,10 @@ static bool delete_node(struct radix_tree_root *root, | |||
805 | */ | 810 | */ |
806 | int __radix_tree_create(struct radix_tree_root *root, unsigned long index, | 811 | int __radix_tree_create(struct radix_tree_root *root, unsigned long index, |
807 | unsigned order, struct radix_tree_node **nodep, | 812 | unsigned order, struct radix_tree_node **nodep, |
808 | void ***slotp) | 813 | void __rcu ***slotp) |
809 | { | 814 | { |
810 | struct radix_tree_node *node = NULL, *child; | 815 | struct radix_tree_node *node = NULL, *child; |
811 | void **slot = (void **)&root->rnode; | 816 | void __rcu **slot = (void __rcu **)&root->rnode; |
812 | unsigned long maxindex; | 817 | unsigned long maxindex; |
813 | unsigned int shift, offset = 0; | 818 | unsigned int shift, offset = 0; |
814 | unsigned long max = index | ((1UL << order) - 1); | 819 | unsigned long max = index | ((1UL << order) - 1); |
@@ -890,8 +895,8 @@ static void radix_tree_free_nodes(struct radix_tree_node *node) | |||
890 | } | 895 | } |
891 | 896 | ||
892 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 897 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
893 | static inline int insert_entries(struct radix_tree_node *node, void **slot, | 898 | static inline int insert_entries(struct radix_tree_node *node, |
894 | void *item, unsigned order, bool replace) | 899 | void __rcu **slot, void *item, unsigned order, bool replace) |
895 | { | 900 | { |
896 | struct radix_tree_node *child; | 901 | struct radix_tree_node *child; |
897 | unsigned i, n, tag, offset, tags = 0; | 902 | unsigned i, n, tag, offset, tags = 0; |
@@ -953,8 +958,8 @@ static inline int insert_entries(struct radix_tree_node *node, void **slot, | |||
953 | return n; | 958 | return n; |
954 | } | 959 | } |
955 | #else | 960 | #else |
956 | static inline int insert_entries(struct radix_tree_node *node, void **slot, | 961 | static inline int insert_entries(struct radix_tree_node *node, |
957 | void *item, unsigned order, bool replace) | 962 | void __rcu **slot, void *item, unsigned order, bool replace) |
958 | { | 963 | { |
959 | if (*slot) | 964 | if (*slot) |
960 | return -EEXIST; | 965 | return -EEXIST; |
@@ -981,7 +986,7 @@ int __radix_tree_insert(struct radix_tree_root *root, unsigned long index, | |||
981 | unsigned order, void *item) | 986 | unsigned order, void *item) |
982 | { | 987 | { |
983 | struct radix_tree_node *node; | 988 | struct radix_tree_node *node; |
984 | void **slot; | 989 | void __rcu **slot; |
985 | int error; | 990 | int error; |
986 | 991 | ||
987 | BUG_ON(radix_tree_is_internal_node(item)); | 992 | BUG_ON(radix_tree_is_internal_node(item)); |
@@ -1023,15 +1028,15 @@ EXPORT_SYMBOL(__radix_tree_insert); | |||
1023 | */ | 1028 | */ |
1024 | void *__radix_tree_lookup(const struct radix_tree_root *root, | 1029 | void *__radix_tree_lookup(const struct radix_tree_root *root, |
1025 | unsigned long index, struct radix_tree_node **nodep, | 1030 | unsigned long index, struct radix_tree_node **nodep, |
1026 | void ***slotp) | 1031 | void __rcu ***slotp) |
1027 | { | 1032 | { |
1028 | struct radix_tree_node *node, *parent; | 1033 | struct radix_tree_node *node, *parent; |
1029 | unsigned long maxindex; | 1034 | unsigned long maxindex; |
1030 | void **slot; | 1035 | void __rcu **slot; |
1031 | 1036 | ||
1032 | restart: | 1037 | restart: |
1033 | parent = NULL; | 1038 | parent = NULL; |
1034 | slot = (void **)&root->rnode; | 1039 | slot = (void __rcu **)&root->rnode; |
1035 | radix_tree_load_root(root, &node, &maxindex); | 1040 | radix_tree_load_root(root, &node, &maxindex); |
1036 | if (index > maxindex) | 1041 | if (index > maxindex) |
1037 | return NULL; | 1042 | return NULL; |
@@ -1066,10 +1071,10 @@ void *__radix_tree_lookup(const struct radix_tree_root *root, | |||
1066 | * exclusive from other writers. Any dereference of the slot must be done | 1071 | * exclusive from other writers. Any dereference of the slot must be done |
1067 | * using radix_tree_deref_slot. | 1072 | * using radix_tree_deref_slot. |
1068 | */ | 1073 | */ |
1069 | void **radix_tree_lookup_slot(const struct radix_tree_root *root, | 1074 | void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *root, |
1070 | unsigned long index) | 1075 | unsigned long index) |
1071 | { | 1076 | { |
1072 | void **slot; | 1077 | void __rcu **slot; |
1073 | 1078 | ||
1074 | if (!__radix_tree_lookup(root, index, NULL, &slot)) | 1079 | if (!__radix_tree_lookup(root, index, NULL, &slot)) |
1075 | return NULL; | 1080 | return NULL; |
@@ -1096,7 +1101,7 @@ void *radix_tree_lookup(const struct radix_tree_root *root, unsigned long index) | |||
1096 | EXPORT_SYMBOL(radix_tree_lookup); | 1101 | EXPORT_SYMBOL(radix_tree_lookup); |
1097 | 1102 | ||
1098 | static inline void replace_sibling_entries(struct radix_tree_node *node, | 1103 | static inline void replace_sibling_entries(struct radix_tree_node *node, |
1099 | void **slot, int count, int exceptional) | 1104 | void __rcu **slot, int count, int exceptional) |
1100 | { | 1105 | { |
1101 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 1106 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
1102 | void *ptr = node_to_entry(slot); | 1107 | void *ptr = node_to_entry(slot); |
@@ -1115,8 +1120,8 @@ static inline void replace_sibling_entries(struct radix_tree_node *node, | |||
1115 | #endif | 1120 | #endif |
1116 | } | 1121 | } |
1117 | 1122 | ||
1118 | static void replace_slot(void **slot, void *item, struct radix_tree_node *node, | 1123 | static void replace_slot(void __rcu **slot, void *item, |
1119 | int count, int exceptional) | 1124 | struct radix_tree_node *node, int count, int exceptional) |
1120 | { | 1125 | { |
1121 | if (WARN_ON_ONCE(radix_tree_is_internal_node(item))) | 1126 | if (WARN_ON_ONCE(radix_tree_is_internal_node(item))) |
1122 | return; | 1127 | return; |
@@ -1147,7 +1152,7 @@ static bool node_tag_get(const struct radix_tree_root *root, | |||
1147 | * deleted. | 1152 | * deleted. |
1148 | */ | 1153 | */ |
1149 | static int calculate_count(struct radix_tree_root *root, | 1154 | static int calculate_count(struct radix_tree_root *root, |
1150 | struct radix_tree_node *node, void **slot, | 1155 | struct radix_tree_node *node, void __rcu **slot, |
1151 | void *item, void *old) | 1156 | void *item, void *old) |
1152 | { | 1157 | { |
1153 | if (is_idr(root)) { | 1158 | if (is_idr(root)) { |
@@ -1175,7 +1180,7 @@ static int calculate_count(struct radix_tree_root *root, | |||
1175 | */ | 1180 | */ |
1176 | void __radix_tree_replace(struct radix_tree_root *root, | 1181 | void __radix_tree_replace(struct radix_tree_root *root, |
1177 | struct radix_tree_node *node, | 1182 | struct radix_tree_node *node, |
1178 | void **slot, void *item, | 1183 | void __rcu **slot, void *item, |
1179 | radix_tree_update_node_t update_node, void *private) | 1184 | radix_tree_update_node_t update_node, void *private) |
1180 | { | 1185 | { |
1181 | void *old = rcu_dereference_raw(*slot); | 1186 | void *old = rcu_dereference_raw(*slot); |
@@ -1188,7 +1193,7 @@ void __radix_tree_replace(struct radix_tree_root *root, | |||
1188 | * deleting entries, but that needs accounting against the | 1193 | * deleting entries, but that needs accounting against the |
1189 | * node unless the slot is root->rnode. | 1194 | * node unless the slot is root->rnode. |
1190 | */ | 1195 | */ |
1191 | WARN_ON_ONCE(!node && (slot != (void **)&root->rnode) && | 1196 | WARN_ON_ONCE(!node && (slot != (void __rcu **)&root->rnode) && |
1192 | (count || exceptional)); | 1197 | (count || exceptional)); |
1193 | replace_slot(slot, item, node, count, exceptional); | 1198 | replace_slot(slot, item, node, count, exceptional); |
1194 | 1199 | ||
@@ -1218,7 +1223,7 @@ void __radix_tree_replace(struct radix_tree_root *root, | |||
1218 | * radix_tree_iter_replace(). | 1223 | * radix_tree_iter_replace(). |
1219 | */ | 1224 | */ |
1220 | void radix_tree_replace_slot(struct radix_tree_root *root, | 1225 | void radix_tree_replace_slot(struct radix_tree_root *root, |
1221 | void **slot, void *item) | 1226 | void __rcu **slot, void *item) |
1222 | { | 1227 | { |
1223 | __radix_tree_replace(root, NULL, slot, item, NULL, NULL); | 1228 | __radix_tree_replace(root, NULL, slot, item, NULL, NULL); |
1224 | } | 1229 | } |
@@ -1233,7 +1238,8 @@ void radix_tree_replace_slot(struct radix_tree_root *root, | |||
1233 | * Caller must hold tree write locked across split and replacement. | 1238 | * Caller must hold tree write locked across split and replacement. |
1234 | */ | 1239 | */ |
1235 | void radix_tree_iter_replace(struct radix_tree_root *root, | 1240 | void radix_tree_iter_replace(struct radix_tree_root *root, |
1236 | const struct radix_tree_iter *iter, void **slot, void *item) | 1241 | const struct radix_tree_iter *iter, |
1242 | void __rcu **slot, void *item) | ||
1237 | { | 1243 | { |
1238 | __radix_tree_replace(root, iter->node, slot, item, NULL, NULL); | 1244 | __radix_tree_replace(root, iter->node, slot, item, NULL, NULL); |
1239 | } | 1245 | } |
@@ -1257,7 +1263,7 @@ int radix_tree_join(struct radix_tree_root *root, unsigned long index, | |||
1257 | unsigned order, void *item) | 1263 | unsigned order, void *item) |
1258 | { | 1264 | { |
1259 | struct radix_tree_node *node; | 1265 | struct radix_tree_node *node; |
1260 | void **slot; | 1266 | void __rcu **slot; |
1261 | int error; | 1267 | int error; |
1262 | 1268 | ||
1263 | BUG_ON(radix_tree_is_internal_node(item)); | 1269 | BUG_ON(radix_tree_is_internal_node(item)); |
@@ -1292,7 +1298,7 @@ int radix_tree_split(struct radix_tree_root *root, unsigned long index, | |||
1292 | unsigned order) | 1298 | unsigned order) |
1293 | { | 1299 | { |
1294 | struct radix_tree_node *parent, *node, *child; | 1300 | struct radix_tree_node *parent, *node, *child; |
1295 | void **slot; | 1301 | void __rcu **slot; |
1296 | unsigned int offset, end; | 1302 | unsigned int offset, end; |
1297 | unsigned n, tag, tags = 0; | 1303 | unsigned n, tag, tags = 0; |
1298 | gfp_t gfp = root_gfp_mask(root); | 1304 | gfp_t gfp = root_gfp_mask(root); |
@@ -1603,8 +1609,8 @@ static void set_iter_tags(struct radix_tree_iter *iter, | |||
1603 | } | 1609 | } |
1604 | 1610 | ||
1605 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 1611 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
1606 | static void **skip_siblings(struct radix_tree_node **nodep, | 1612 | static void __rcu **skip_siblings(struct radix_tree_node **nodep, |
1607 | void **slot, struct radix_tree_iter *iter) | 1613 | void __rcu **slot, struct radix_tree_iter *iter) |
1608 | { | 1614 | { |
1609 | void *sib = node_to_entry(slot - 1); | 1615 | void *sib = node_to_entry(slot - 1); |
1610 | 1616 | ||
@@ -1621,8 +1627,8 @@ static void **skip_siblings(struct radix_tree_node **nodep, | |||
1621 | return NULL; | 1627 | return NULL; |
1622 | } | 1628 | } |
1623 | 1629 | ||
1624 | void ** __radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, | 1630 | void __rcu **__radix_tree_next_slot(void __rcu **slot, |
1625 | unsigned flags) | 1631 | struct radix_tree_iter *iter, unsigned flags) |
1626 | { | 1632 | { |
1627 | unsigned tag = flags & RADIX_TREE_ITER_TAG_MASK; | 1633 | unsigned tag = flags & RADIX_TREE_ITER_TAG_MASK; |
1628 | struct radix_tree_node *node = rcu_dereference_raw(*slot); | 1634 | struct radix_tree_node *node = rcu_dereference_raw(*slot); |
@@ -1675,14 +1681,15 @@ void ** __radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, | |||
1675 | } | 1681 | } |
1676 | EXPORT_SYMBOL(__radix_tree_next_slot); | 1682 | EXPORT_SYMBOL(__radix_tree_next_slot); |
1677 | #else | 1683 | #else |
1678 | static void **skip_siblings(struct radix_tree_node **nodep, | 1684 | static void __rcu **skip_siblings(struct radix_tree_node **nodep, |
1679 | void **slot, struct radix_tree_iter *iter) | 1685 | void __rcu **slot, struct radix_tree_iter *iter) |
1680 | { | 1686 | { |
1681 | return slot; | 1687 | return slot; |
1682 | } | 1688 | } |
1683 | #endif | 1689 | #endif |
1684 | 1690 | ||
1685 | void **radix_tree_iter_resume(void **slot, struct radix_tree_iter *iter) | 1691 | void __rcu **radix_tree_iter_resume(void __rcu **slot, |
1692 | struct radix_tree_iter *iter) | ||
1686 | { | 1693 | { |
1687 | struct radix_tree_node *node; | 1694 | struct radix_tree_node *node; |
1688 | 1695 | ||
@@ -1703,7 +1710,7 @@ EXPORT_SYMBOL(radix_tree_iter_resume); | |||
1703 | * @flags: RADIX_TREE_ITER_* flags and tag index | 1710 | * @flags: RADIX_TREE_ITER_* flags and tag index |
1704 | * Returns: pointer to chunk first slot, or NULL if iteration is over | 1711 | * Returns: pointer to chunk first slot, or NULL if iteration is over |
1705 | */ | 1712 | */ |
1706 | void **radix_tree_next_chunk(const struct radix_tree_root *root, | 1713 | void __rcu **radix_tree_next_chunk(const struct radix_tree_root *root, |
1707 | struct radix_tree_iter *iter, unsigned flags) | 1714 | struct radix_tree_iter *iter, unsigned flags) |
1708 | { | 1715 | { |
1709 | unsigned tag = flags & RADIX_TREE_ITER_TAG_MASK; | 1716 | unsigned tag = flags & RADIX_TREE_ITER_TAG_MASK; |
@@ -1740,7 +1747,7 @@ void **radix_tree_next_chunk(const struct radix_tree_root *root, | |||
1740 | iter->tags = 1; | 1747 | iter->tags = 1; |
1741 | iter->node = NULL; | 1748 | iter->node = NULL; |
1742 | __set_iter_shift(iter, 0); | 1749 | __set_iter_shift(iter, 0); |
1743 | return (void **)&root->rnode; | 1750 | return (void __rcu **)&root->rnode; |
1744 | } | 1751 | } |
1745 | 1752 | ||
1746 | do { | 1753 | do { |
@@ -1819,7 +1826,7 @@ radix_tree_gang_lookup(const struct radix_tree_root *root, void **results, | |||
1819 | unsigned long first_index, unsigned int max_items) | 1826 | unsigned long first_index, unsigned int max_items) |
1820 | { | 1827 | { |
1821 | struct radix_tree_iter iter; | 1828 | struct radix_tree_iter iter; |
1822 | void **slot; | 1829 | void __rcu **slot; |
1823 | unsigned int ret = 0; | 1830 | unsigned int ret = 0; |
1824 | 1831 | ||
1825 | if (unlikely(!max_items)) | 1832 | if (unlikely(!max_items)) |
@@ -1861,11 +1868,11 @@ EXPORT_SYMBOL(radix_tree_gang_lookup); | |||
1861 | */ | 1868 | */ |
1862 | unsigned int | 1869 | unsigned int |
1863 | radix_tree_gang_lookup_slot(const struct radix_tree_root *root, | 1870 | radix_tree_gang_lookup_slot(const struct radix_tree_root *root, |
1864 | void ***results, unsigned long *indices, | 1871 | void __rcu ***results, unsigned long *indices, |
1865 | unsigned long first_index, unsigned int max_items) | 1872 | unsigned long first_index, unsigned int max_items) |
1866 | { | 1873 | { |
1867 | struct radix_tree_iter iter; | 1874 | struct radix_tree_iter iter; |
1868 | void **slot; | 1875 | void __rcu **slot; |
1869 | unsigned int ret = 0; | 1876 | unsigned int ret = 0; |
1870 | 1877 | ||
1871 | if (unlikely(!max_items)) | 1878 | if (unlikely(!max_items)) |
@@ -1902,7 +1909,7 @@ radix_tree_gang_lookup_tag(const struct radix_tree_root *root, void **results, | |||
1902 | unsigned int tag) | 1909 | unsigned int tag) |
1903 | { | 1910 | { |
1904 | struct radix_tree_iter iter; | 1911 | struct radix_tree_iter iter; |
1905 | void **slot; | 1912 | void __rcu **slot; |
1906 | unsigned int ret = 0; | 1913 | unsigned int ret = 0; |
1907 | 1914 | ||
1908 | if (unlikely(!max_items)) | 1915 | if (unlikely(!max_items)) |
@@ -1939,11 +1946,11 @@ EXPORT_SYMBOL(radix_tree_gang_lookup_tag); | |||
1939 | */ | 1946 | */ |
1940 | unsigned int | 1947 | unsigned int |
1941 | radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *root, | 1948 | radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *root, |
1942 | void ***results, unsigned long first_index, | 1949 | void __rcu ***results, unsigned long first_index, |
1943 | unsigned int max_items, unsigned int tag) | 1950 | unsigned int max_items, unsigned int tag) |
1944 | { | 1951 | { |
1945 | struct radix_tree_iter iter; | 1952 | struct radix_tree_iter iter; |
1946 | void **slot; | 1953 | void __rcu **slot; |
1947 | unsigned int ret = 0; | 1954 | unsigned int ret = 0; |
1948 | 1955 | ||
1949 | if (unlikely(!max_items)) | 1956 | if (unlikely(!max_items)) |
@@ -1979,7 +1986,7 @@ void __radix_tree_delete_node(struct radix_tree_root *root, | |||
1979 | } | 1986 | } |
1980 | 1987 | ||
1981 | static bool __radix_tree_delete(struct radix_tree_root *root, | 1988 | static bool __radix_tree_delete(struct radix_tree_root *root, |
1982 | struct radix_tree_node *node, void **slot) | 1989 | struct radix_tree_node *node, void __rcu **slot) |
1983 | { | 1990 | { |
1984 | void *old = rcu_dereference_raw(*slot); | 1991 | void *old = rcu_dereference_raw(*slot); |
1985 | int exceptional = radix_tree_exceptional_entry(old) ? -1 : 0; | 1992 | int exceptional = radix_tree_exceptional_entry(old) ? -1 : 0; |
@@ -2009,7 +2016,7 @@ static bool __radix_tree_delete(struct radix_tree_root *root, | |||
2009 | * which can access this tree. | 2016 | * which can access this tree. |
2010 | */ | 2017 | */ |
2011 | void radix_tree_iter_delete(struct radix_tree_root *root, | 2018 | void radix_tree_iter_delete(struct radix_tree_root *root, |
2012 | struct radix_tree_iter *iter, void **slot) | 2019 | struct radix_tree_iter *iter, void __rcu **slot) |
2013 | { | 2020 | { |
2014 | if (__radix_tree_delete(root, iter->node, slot)) | 2021 | if (__radix_tree_delete(root, iter->node, slot)) |
2015 | iter->index = iter->next_index; | 2022 | iter->index = iter->next_index; |
@@ -2030,7 +2037,7 @@ void *radix_tree_delete_item(struct radix_tree_root *root, | |||
2030 | unsigned long index, void *item) | 2037 | unsigned long index, void *item) |
2031 | { | 2038 | { |
2032 | struct radix_tree_node *node = NULL; | 2039 | struct radix_tree_node *node = NULL; |
2033 | void **slot; | 2040 | void __rcu **slot; |
2034 | void *entry; | 2041 | void *entry; |
2035 | 2042 | ||
2036 | entry = __radix_tree_lookup(root, index, &node, &slot); | 2043 | entry = __radix_tree_lookup(root, index, &node, &slot); |
@@ -2064,7 +2071,7 @@ EXPORT_SYMBOL(radix_tree_delete); | |||
2064 | 2071 | ||
2065 | void radix_tree_clear_tags(struct radix_tree_root *root, | 2072 | void radix_tree_clear_tags(struct radix_tree_root *root, |
2066 | struct radix_tree_node *node, | 2073 | struct radix_tree_node *node, |
2067 | void **slot) | 2074 | void __rcu **slot) |
2068 | { | 2075 | { |
2069 | if (node) { | 2076 | if (node) { |
2070 | unsigned int tag, offset = get_slot_offset(node, slot); | 2077 | unsigned int tag, offset = get_slot_offset(node, slot); |
@@ -2129,11 +2136,11 @@ int ida_pre_get(struct ida *ida, gfp_t gfp) | |||
2129 | } | 2136 | } |
2130 | EXPORT_SYMBOL(ida_pre_get); | 2137 | EXPORT_SYMBOL(ida_pre_get); |
2131 | 2138 | ||
2132 | void **idr_get_free(struct radix_tree_root *root, | 2139 | void __rcu **idr_get_free(struct radix_tree_root *root, |
2133 | struct radix_tree_iter *iter, gfp_t gfp, int end) | 2140 | struct radix_tree_iter *iter, gfp_t gfp, int end) |
2134 | { | 2141 | { |
2135 | struct radix_tree_node *node = NULL, *child; | 2142 | struct radix_tree_node *node = NULL, *child; |
2136 | void **slot = (void **)&root->rnode; | 2143 | void __rcu **slot = (void __rcu **)&root->rnode; |
2137 | unsigned long maxindex, start = iter->next_index; | 2144 | unsigned long maxindex, start = iter->next_index; |
2138 | unsigned long max = end > 0 ? end - 1 : INT_MAX; | 2145 | unsigned long max = end > 0 ? end - 1 : INT_MAX; |
2139 | unsigned int shift, offset = 0; | 2146 | unsigned int shift, offset = 0; |