diff options
author | Matthew Wilcox <willy@infradead.org> | 2017-12-01 22:13:06 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-10-21 10:46:40 -0400 |
commit | 7b8d046fba91d62beb8a8f78244aaa3c23a60cdd (patch) | |
tree | 78f7d338690a358a6b67f5e153506feda90eb8bd /lib | |
parent | 552446a4166189a8c2515571dd6e25fd64a2dc78 (diff) |
shmem: Convert shmem_alloc_hugepage to XArray
xa_find() is a slightly easier API to use than
radix_tree_gang_lookup_slot() because it contains its own RCU locking.
This commit removes the last user of radix_tree_gang_lookup_slot()
so remove the function too.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/radix-tree.c | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 8a58051eb5b3..2f9c0e45eeb7 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -1097,7 +1097,7 @@ void __radix_tree_replace(struct radix_tree_root *root, | |||
1097 | * @slot: pointer to slot | 1097 | * @slot: pointer to slot |
1098 | * @item: new item to store in the slot. | 1098 | * @item: new item to store in the slot. |
1099 | * | 1099 | * |
1100 | * For use with radix_tree_lookup_slot(), radix_tree_gang_lookup_slot(), | 1100 | * For use with radix_tree_lookup_slot() and |
1101 | * radix_tree_gang_lookup_tag_slot(). Caller must hold tree write locked | 1101 | * radix_tree_gang_lookup_tag_slot(). Caller must hold tree write locked |
1102 | * across slot lookup and replacement. | 1102 | * across slot lookup and replacement. |
1103 | * | 1103 | * |
@@ -1732,48 +1732,6 @@ radix_tree_gang_lookup(const struct radix_tree_root *root, void **results, | |||
1732 | EXPORT_SYMBOL(radix_tree_gang_lookup); | 1732 | EXPORT_SYMBOL(radix_tree_gang_lookup); |
1733 | 1733 | ||
1734 | /** | 1734 | /** |
1735 | * radix_tree_gang_lookup_slot - perform multiple slot lookup on radix tree | ||
1736 | * @root: radix tree root | ||
1737 | * @results: where the results of the lookup are placed | ||
1738 | * @indices: where their indices should be placed (but usually NULL) | ||
1739 | * @first_index: start the lookup from this key | ||
1740 | * @max_items: place up to this many items at *results | ||
1741 | * | ||
1742 | * Performs an index-ascending scan of the tree for present items. Places | ||
1743 | * their slots at *@results and returns the number of items which were | ||
1744 | * placed at *@results. | ||
1745 | * | ||
1746 | * The implementation is naive. | ||
1747 | * | ||
1748 | * Like radix_tree_gang_lookup as far as RCU and locking goes. Slots must | ||
1749 | * be dereferenced with radix_tree_deref_slot, and if using only RCU | ||
1750 | * protection, radix_tree_deref_slot may fail requiring a retry. | ||
1751 | */ | ||
1752 | unsigned int | ||
1753 | radix_tree_gang_lookup_slot(const struct radix_tree_root *root, | ||
1754 | void __rcu ***results, unsigned long *indices, | ||
1755 | unsigned long first_index, unsigned int max_items) | ||
1756 | { | ||
1757 | struct radix_tree_iter iter; | ||
1758 | void __rcu **slot; | ||
1759 | unsigned int ret = 0; | ||
1760 | |||
1761 | if (unlikely(!max_items)) | ||
1762 | return 0; | ||
1763 | |||
1764 | radix_tree_for_each_slot(slot, root, &iter, first_index) { | ||
1765 | results[ret] = slot; | ||
1766 | if (indices) | ||
1767 | indices[ret] = iter.index; | ||
1768 | if (++ret == max_items) | ||
1769 | break; | ||
1770 | } | ||
1771 | |||
1772 | return ret; | ||
1773 | } | ||
1774 | EXPORT_SYMBOL(radix_tree_gang_lookup_slot); | ||
1775 | |||
1776 | /** | ||
1777 | * radix_tree_gang_lookup_tag - perform multiple lookup on a radix tree | 1735 | * radix_tree_gang_lookup_tag - perform multiple lookup on a radix tree |
1778 | * based on a tag | 1736 | * based on a tag |
1779 | * @root: radix tree root | 1737 | * @root: radix tree root |