Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1378944
| From | Matthew Wilcox <willy@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 12/19] radix-tree: Change naming conventions in radix_tree_shrink |
| Date | 2016-04-14 16:40 +0200 |
| Message-ID | <rnQB5-33W-39@gated-at.bofh.it> (permalink) |
| References | <rnQB5-33W-35@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Use the more standard 'node' and 'child' instead of 'to_free' and 'slot'.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
lib/radix-tree.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 145dcb1..094dfc0 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -1396,37 +1396,37 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root)
bool shrunk = false;
for (;;) {
- struct radix_tree_node *to_free = root->rnode;
- struct radix_tree_node *slot;
+ struct radix_tree_node *node = root->rnode;
+ struct radix_tree_node *child;
- if (!radix_tree_is_internal_node(to_free))
+ if (!radix_tree_is_internal_node(node))
break;
- to_free = entry_to_node(to_free);
+ node = entry_to_node(node);
/*
* The candidate node has more than one child, or its child
* is not at the leftmost slot, or the child is a multiorder
* entry, we cannot shrink.
*/
- if (to_free->count != 1)
+ if (node->count != 1)
break;
- slot = to_free->slots[0];
- if (!slot)
+ child = node->slots[0];
+ if (!child)
break;
- if (!radix_tree_is_internal_node(slot) && to_free->shift)
+ if (!radix_tree_is_internal_node(child) && node->shift)
break;
- if (radix_tree_is_internal_node(slot))
- entry_to_node(slot)->parent = NULL;
+ if (radix_tree_is_internal_node(child))
+ entry_to_node(child)->parent = NULL;
/*
* We don't need rcu_assign_pointer(), since we are simply
* moving the node from one part of the tree to another: if it
* was safe to dereference the old pointer to it
- * (to_free->slots[0]), it will be safe to dereference the new
+ * (node->slots[0]), it will be safe to dereference the new
* one (root->rnode) as far as dependent read barriers go.
*/
- root->rnode = slot;
+ root->rnode = child;
/*
* We have a dilemma here. The node's slot[0] must not be
@@ -1446,10 +1446,10 @@ static inline bool radix_tree_shrink(struct radix_tree_root *root)
* also results in a stale slot). So tag the slot as indirect
* to force callers to retry.
*/
- if (!radix_tree_is_internal_node(slot))
- to_free->slots[0] = RADIX_TREE_RETRY;
+ if (!radix_tree_is_internal_node(child))
+ node->slots[0] = RADIX_TREE_RETRY;
- radix_tree_node_free(to_free);
+ radix_tree_node_free(node);
shrunk = true;
}
--
2.8.0.rc3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/19] Radix tree cleanups Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 12/19] radix-tree: Change naming conventions in radix_tree_shrink Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 16/19] radix-tree: Introduce radix_tree_replace_clear_tags() Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 17/19] radix-tree: Make radix_tree_descend() more useful Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 01/19] drivers/hwspinlock: Use correct radix tree API Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 05/19] radix-tree: Remove a use of root->height from delete_node Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 18/19] dax: move RADIX_DAX_ definitions to dax.c Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:40 +0200 [PATCH 11/19] radix-tree: Rename radix_tree_is_indirect_ptr() Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 06/19] radix tree test suite: Remove dependencies on height Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 02/19] radix-tree: Miscellaneous fixes Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 04/19] radix-tree: Replace node->height with node->shift Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 10/19] radix-tree: Rename indirect_to_ptr() to entry_to_node() Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 13/19] radix-tree: Tidy up next_chunk Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 14/19] radix-tree: Tidy up range_tag_if_tagged Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 15/19] radix-tree: Tidy up __radix_tree_create() Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 08/19] radix-tree: Rename INDIRECT_PTR to INTERNAL_NODE Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 03/19] radix-tree: Split node->path into offset and height Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200 [PATCH 09/19] radix-tree: Rename ptr_to_indirect() to node_to_entry() Matthew Wilcox <willy@linux.intel.com> - 2016-04-14 16:50 +0200
csiph-web