* The notable exceptions to this rule are the following functions:
* __radix_tree_lookup
* radix_tree_lookup
- * radix_tree_lookup_slot
* radix_tree_tag_get
* radix_tree_tagged
*
* radix_tree_tagged is able to be called without locking or RCU.
*/
-/**
- * radix_tree_deref_slot - dereference a slot
- * @slot: slot pointer, returned by radix_tree_lookup_slot
- *
- * For use with radix_tree_lookup_slot(). Caller must hold tree at least read
- * locked across slot lookup and dereference. Not required if write lock is
- * held (ie. items cannot be concurrently inserted).
- *
- * radix_tree_deref_retry must be used to confirm validity of the pointer if
- * only the read lock is held.
- *
- * Return: entry stored in that slot.
- */
-static inline void *radix_tree_deref_slot(void __rcu **slot)
-{
- return rcu_dereference(*slot);
-}
-
-/**
- * radix_tree_deref_slot_protected - dereference a slot with tree lock held
- * @slot: slot pointer, returned by radix_tree_lookup_slot
- *
- * Similar to radix_tree_deref_slot. The caller does not hold the RCU read
- * lock but it must hold the tree lock to prevent parallel updates.
- *
- * Return: entry stored in that slot.
- */
-static inline void *radix_tree_deref_slot_protected(void __rcu **slot,
- spinlock_t *treelock)
-{
- return rcu_dereference_protected(*slot, lockdep_is_held(treelock));
-}
-
-/**
- * radix_tree_deref_retry - check radix_tree_deref_slot
- * @arg: pointer returned by radix_tree_deref_slot
- * Returns: 0 if retry is not required, otherwise retry is required
- *
- * radix_tree_deref_retry must be used with radix_tree_deref_slot.
- */
-static inline int radix_tree_deref_retry(void *arg)
-{
- return unlikely(radix_tree_is_internal_node(arg));
-}
-
-/**
- * radix_tree_exception - radix_tree_deref_slot returned either exception?
- * @arg: value returned by radix_tree_deref_slot
- * Returns: 0 if well-aligned pointer, non-0 if either kind of exception.
- */
-static inline int radix_tree_exception(void *arg)
-{
- return unlikely((unsigned long)arg & RADIX_TREE_ENTRY_MASK);
-}
-
int radix_tree_insert(struct radix_tree_root *, unsigned long index,
void *);
void *__radix_tree_lookup(const struct radix_tree_root *, unsigned long index,
struct radix_tree_node **nodep, void __rcu ***slotp);
void *radix_tree_lookup(const struct radix_tree_root *, unsigned long);
-void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *,
- unsigned long index);
void __radix_tree_replace(struct radix_tree_root *, struct radix_tree_node *,
void __rcu **slot, void *entry);
void radix_tree_iter_replace(struct radix_tree_root *,
const struct radix_tree_iter *, void __rcu **slot, void *entry);
-void radix_tree_replace_slot(struct radix_tree_root *,
- void __rcu **slot, void *entry);
void radix_tree_iter_delete(struct radix_tree_root *,
struct radix_tree_iter *iter, void __rcu **slot);
void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *);
return node;
}
-/**
- * radix_tree_lookup_slot - lookup a slot in a radix tree
- * @root: radix tree root
- * @index: index key
- *
- * Returns: the slot corresponding to the position @index in the
- * radix tree @root. This is useful for update-if-exists operations.
- *
- * This function can be called under rcu_read_lock iff the slot is not
- * modified by radix_tree_replace_slot, otherwise it must be called
- * exclusive from other writers. Any dereference of the slot must be done
- * using radix_tree_deref_slot.
- */
-void __rcu **radix_tree_lookup_slot(const struct radix_tree_root *root,
- unsigned long index)
-{
- void __rcu **slot;
-
- if (!__radix_tree_lookup(root, index, NULL, &slot))
- return NULL;
- return slot;
-}
-EXPORT_SYMBOL(radix_tree_lookup_slot);
-
/**
* radix_tree_lookup - perform lookup operation on a radix tree
* @root: radix tree root
delete_node(root, node);
}
-/**
- * radix_tree_replace_slot - replace item in a slot
- * @root: radix tree root
- * @slot: pointer to slot
- * @item: new item to store in the slot.
- *
- * For use with radix_tree_lookup_slot(). Caller must hold tree write locked
- * across slot lookup and replacement.
- *
- * NOTE: This cannot be used to switch between non-entries (empty slots),
- * regular entries, and value entries, as that requires accounting
- * inside the radix tree node. When switching from one type of entry or
- * deleting, use __radix_tree_lookup() and __radix_tree_replace() or
- * radix_tree_iter_replace().
- */
-void radix_tree_replace_slot(struct radix_tree_root *root,
- void __rcu **slot, void *item)
-{
- __radix_tree_replace(root, NULL, slot, item);
-}
-EXPORT_SYMBOL(radix_tree_replace_slot);
-
/**
* radix_tree_iter_replace - replace item in a slot
* @root: radix tree root