* - any function _modifying_ the tree or tags (inserting or deleting
* items, setting or clearing tags) must exclude other modifications, and
* exclude any functions reading the tree.
- * - any function _reading_ the tree or tags (looking up items or tags,
- * gang lookups) must exclude modifications to the tree, but may occur
+ * - any function _reading_ the tree or tags (looking up items or tags)
+ * must exclude modifications to the tree, but may occur
* concurrently with other readers.
*
* The notable exceptions to this rule are the following functions:
* radix_tree_lookup
* radix_tree_lookup_slot
* radix_tree_tag_get
- * radix_tree_gang_lookup
- * radix_tree_gang_lookup_tag
* radix_tree_tagged
*
* The first 7 functions are able to be called locklessly, using RCU. The
struct radix_tree_iter *iter, void __rcu **slot);
void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *);
void *radix_tree_delete(struct radix_tree_root *, unsigned long);
-unsigned int radix_tree_gang_lookup(const struct radix_tree_root *,
- void **results, unsigned long first_index,
- unsigned int max_items);
void radix_tree_init(void);
void *radix_tree_tag_set(struct radix_tree_root *,
unsigned long index, unsigned int tag);
unsigned long index, unsigned int tag);
void radix_tree_iter_tag_clear(struct radix_tree_root *,
const struct radix_tree_iter *iter, unsigned int tag);
-unsigned int radix_tree_gang_lookup_tag(const struct radix_tree_root *,
- void **results, unsigned long first_index,
- unsigned int max_items, unsigned int tag);
int radix_tree_tagged(const struct radix_tree_root *, unsigned int tag);
void __rcu **idr_get_free(struct radix_tree_root *root,
}
EXPORT_SYMBOL(radix_tree_next_chunk);
-/**
- * radix_tree_gang_lookup - perform multiple lookup on a radix tree
- * @root: radix tree root
- * @results: where the results of the lookup are placed
- * @first_index: start the lookup from this key
- * @max_items: place up to this many items at *results
- *
- * Performs an index-ascending scan of the tree for present items. Places
- * them at *@results and returns the number of items which were placed at
- * *@results.
- *
- * The implementation is naive.
- *
- * Like radix_tree_lookup, radix_tree_gang_lookup may be called under
- * rcu_read_lock. In this case, rather than the returned results being
- * an atomic snapshot of the tree at a single point in time, the
- * semantics of an RCU protected gang lookup are as though multiple
- * radix_tree_lookups have been issued in individual locks, and results
- * stored in 'results'.
- */
-unsigned int
-radix_tree_gang_lookup(const struct radix_tree_root *root, void **results,
- unsigned long first_index, unsigned int max_items)
-{
- struct radix_tree_iter iter;
- void __rcu **slot;
- unsigned int ret = 0;
-
- if (unlikely(!max_items))
- return 0;
-
- radix_tree_for_each_slot(slot, root, &iter, first_index) {
- results[ret] = rcu_dereference_raw(*slot);
- if (!results[ret])
- continue;
- if (radix_tree_is_internal_node(results[ret])) {
- slot = radix_tree_iter_retry(&iter);
- continue;
- }
- if (++ret == max_items)
- break;
- }
-
- return ret;
-}
-EXPORT_SYMBOL(radix_tree_gang_lookup);
-
-/**
- * radix_tree_gang_lookup_tag - perform multiple lookup on a radix tree
- * based on a tag
- * @root: radix tree root
- * @results: where the results of the lookup are placed
- * @first_index: start the lookup from this key
- * @max_items: place up to this many items at *results
- * @tag: the tag index (< RADIX_TREE_MAX_TAGS)
- *
- * Performs an index-ascending scan of the tree for present items which
- * have the tag indexed by @tag set. Places the items at *@results and
- * returns the number of items which were placed at *@results.
- */
-unsigned int
-radix_tree_gang_lookup_tag(const struct radix_tree_root *root, void **results,
- unsigned long first_index, unsigned int max_items,
- unsigned int tag)
-{
- struct radix_tree_iter iter;
- void __rcu **slot;
- unsigned int ret = 0;
-
- if (unlikely(!max_items))
- return 0;
-
- radix_tree_for_each_tagged(slot, root, &iter, first_index, tag) {
- results[ret] = rcu_dereference_raw(*slot);
- if (!results[ret])
- continue;
- if (radix_tree_is_internal_node(results[ret])) {
- slot = radix_tree_iter_retry(&iter);
- continue;
- }
- if (++ret == max_items)
- break;
- }
-
- return ret;
-}
-EXPORT_SYMBOL(radix_tree_gang_lookup_tag);
-
static bool __radix_tree_delete(struct radix_tree_root *root,
struct radix_tree_node *node, void __rcu **slot)
{