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>
This commit is contained in:
committed by
Linus Torvalds
parent
a4db4dcea1
commit
4dd6c0987c
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user