[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 01/17] rb_tree: reorganize code in rb_erase() for additional changes



First, move some code around in order to make the next change more obvious.

commit 16c047add3ceaf0ab882e3e094d1ec904d02312d from linux tree

[akpm@xxxxxxxxxxxxxxxxxxxx: coding-style fixes]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Wolfram Strepp <wstrepp@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
---
 xen/common/rbtree.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/xen/common/rbtree.c b/xen/common/rbtree.c
index 3328960d56..9826909a2a 100644
--- a/xen/common/rbtree.c
+++ b/xen/common/rbtree.c
@@ -236,6 +236,16 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
         node = node->rb_right;
         while ((left = node->rb_left) != NULL)
             node = left;
+
+        if (rb_parent(old))
+        {
+            if (rb_parent(old)->rb_left == old)
+                rb_parent(old)->rb_left = node;
+            else
+                rb_parent(old)->rb_right = node;
+        } else
+            root->rb_node = node;
+
         child = node->rb_right;
         parent = rb_parent(node);
         color = rb_color(node);
@@ -252,15 +262,6 @@ void rb_erase(struct rb_node *node, struct rb_root *root)
         node->rb_right = old->rb_right;
         node->rb_left = old->rb_left;
 
-        if (rb_parent(old))
-        {
-            if (rb_parent(old)->rb_left == old)
-                rb_parent(old)->rb_left = node;
-            else
-                rb_parent(old)->rb_right = node;
-        } else
-            root->rb_node = node;
-
         rb_set_parent(old->rb_left, node);
         if (old->rb_right)
             rb_set_parent(old->rb_right, node);
-- 
2.12.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.