radix-tree: rename indirect_to_ptr() to entry_to_node()
Subsystems (2)
[email protected]
maintainerPATCH 138/162 radix-tree: rename indirect_to_ptr() to entry_to_node()
From: Matthew Wilcox <[email protected]>
Subject: 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 <[email protected]>
Cc Konstantin Khlebnikov <[email protected]>
Cc Kirill Shutemov <[email protected]>
Cc Jan Kara <[email protected]>
Cc Neil Brown <[email protected]>
Cc Ross Zwisler <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/radix-tree.h | 12 +++---- lib/radix-tree.c | 48 +++++++++++++----------------- tools/testing/radix-tree/test.c | 4 +- tools/testing/radix-tree/test.h | 1 4 files changed, 28 insertions(+), 37 deletions(-)
include/linux/radix-tree.h renamed from include/linux/radix-tree.h~radix-tree-rename-indirect_to_ptr-to-entry_to_node +5 -7
@@ -442,7 +442,7 @@ radix_tree_chunk_size(struct radix_tree_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, structreturn 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, structif (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))
lib/radix-tree.c renamed from lib/radix-tree.c~radix-tree-rename-indirect_to_ptr-to-entry_to_node +21 -27
161 lines not on this page · raw message
tools/testing/radix-tree/test.c renamed from tools/testing/radix-tree/test.c~radix-tree-rename-indirect_to_ptr-to-entry_to_node +2 -2
@@ -149,7 +149,7 @@ static int verify_node(struct radix_treeint i;int j; - slot =indirect_to_ptr (slot); + slot =entry_to_node (slot);/* Verify consistency at this level */ for (i =0 ; i <RADIX_TREE_TAG_LONGS ; i++) {
@@ -227,7 +227,7 @@ void tree_verify_min_height(struct radixreturn ; } - node =indirect_to_ptr (node); + node =entry_to_node (node);assert (maxindex <=node_maxindex (node)); shift = node->shift;
tools/testing/radix-tree/test.h renamed from tools/testing/radix-tree/test.h~radix-tree-rename-indirect_to_ptr-to-entry_to_node +0 -1
@@ -39,7 +39,6 @@ void verify_tag_consistency(struct radixextern int nr_allocated;/* Normally private parts of lib/radix-tree.c */ -void *indirect_to_ptr (void *ptr);void radix_tree_dump (struct radix_tree_root *root);int root_tag_get (struct radix_tree_root *root,unsigned int tag);unsigned long node_maxindex (struct radix_tree_node *);
_