From: Matthew Wilcox Date: Mon, 29 Oct 2018 16:04:06 +0000 (-0400) Subject: radix tree: Remove radix_tree_gang_lookup* X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fb99f5a2bb651a495b42f2d6afa326e887c58740;p=users%2Fwilly%2Fxarray.git radix tree: Remove radix_tree_gang_lookup* Users of these functions have all been converted to use xa_extract(). Signed-off-by: Matthew Wilcox --- diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 4b9fec9e36c1..074916d743c4 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -120,8 +120,8 @@ struct radix_tree_iter { * - 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: @@ -129,8 +129,6 @@ struct radix_tree_iter { * 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 @@ -229,9 +227,6 @@ 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 *); 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); @@ -241,9 +236,6 @@ int radix_tree_tag_get(const struct radix_tree_root *, 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, diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 91d138b0dfb4..7f8f9fc8bf52 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -1214,94 +1214,6 @@ void __rcu **radix_tree_next_chunk(const 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) {