summaryrefslogtreecommitdiff
path: root/include/linux/radix-tree.h
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@linux.intel.com>2016-05-21 03:03:27 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-21 03:58:30 +0300
commit4dd6c0987ca43d6544f4f0a3f86f6ea3bfc60fc1 (patch)
treeeae410dd9f1b23d16b2cd646065f93653bb48b5e /include/linux/radix-tree.h
parenta4db4dcea1b3990e8c5dc8a03d11f36a3c0c6d8b (diff)
downloadlinux-4dd6c0987ca43d6544f4f0a3f86f6ea3bfc60fc1.tar.xz
radix-tree: rename indirect_to_ptr() to entry_to_node()
Mirrors the earlier commit introducing node_to_entry(). Also change the type returned to be a struct radix_tree_node pointer. That lets us simplify a couple of places in the radix tree shrink & extend paths where we could convert an entry into a pointer, modify the node, then convert the pointer back into an entry. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com> Cc: Jan Kara <jack@suse.com> Cc: Neil Brown <neilb@suse.de> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/radix-tree.h')
-rw-r--r--include/linux/radix-tree.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index c8cc879046c7..b94aa198dd6b 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -442,7 +442,7 @@ radix_tree_chunk_size(struct radix_tree_iter *iter)
return (iter->next_index - iter->index) >> iter_shift(iter);
}
-static inline void *indirect_to_ptr(void *ptr)
+static inline struct radix_tree_node *entry_to_node(void *ptr)
{
return (void *)((unsigned long)ptr & ~RADIX_TREE_INTERNAL_NODE);
}
@@ -469,7 +469,7 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)
return NULL;
while (IS_ENABLED(CONFIG_RADIX_TREE_MULTIORDER) &&
radix_tree_is_indirect_ptr(slot[1])) {
- if (indirect_to_ptr(slot[1]) == canon) {
+ if (entry_to_node(slot[1]) == canon) {
iter->tags >>= 1;
iter->index = __radix_tree_iter_add(iter, 1);
slot++;
@@ -499,12 +499,10 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)
if (IS_ENABLED(CONFIG_RADIX_TREE_MULTIORDER) &&
radix_tree_is_indirect_ptr(*slot)) {
- if (indirect_to_ptr(*slot) == canon)
+ if (entry_to_node(*slot) == canon)
continue;
- else {
- iter->next_index = iter->index;
- break;
- }
+ iter->next_index = iter->index;
+ break;
}
if (likely(*slot))