All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Fix rbtree-interval balancing
@ 2011-05-21  8:51 Sasha Levin
  2011-05-21  8:51 ` [PATCH 2/2] kvm tools: Modify ioport to use interval rbtree Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2011-05-21  8:51 UTC (permalink / raw)
  To: penberg; +Cc: mingo, asias.hejun, gorcunov, prasadjoshi124, kvm, Sasha Levin

Augmentation is started on the pre-rotation node found in the search,
augment the rotated node instead.

Max high is the max of max highs below it, not the max of highs below it.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/util/rbtree-interval.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/util/rbtree-interval.c b/tools/kvm/util/rbtree-interval.c
index 735e912..d02fbf0 100644
--- a/tools/kvm/util/rbtree-interval.c
+++ b/tools/kvm/util/rbtree-interval.c
@@ -51,9 +51,9 @@ static void update_node_max_high(struct rb_node *node, void *arg)
 	i_node->max_high = i_node->high;
 
 	if (node->rb_left)
-		i_node->max_high = max(i_node->max_high, rb_int(node->rb_left)->high);
+		i_node->max_high = max(i_node->max_high, rb_int(node->rb_left)->max_high);
 	if (node->rb_right)
-		i_node->max_high = max(i_node->max_high, rb_int(node->rb_right)->high);
+		i_node->max_high = max(i_node->max_high, rb_int(node->rb_right)->max_high);
 }
 
 int rb_int_insert(struct rb_root *root, struct rb_int_node *i_node)
@@ -75,7 +75,7 @@ int rb_int_insert(struct rb_root *root, struct rb_int_node *i_node)
 	rb_link_node(&i_node->node, parent, node);
 	rb_insert_color(&i_node->node, root);
 
-	rb_augment_insert(*node, update_node_max_high, NULL);
+	rb_augment_insert(&i_node->node, update_node_max_high, NULL);
 	return 1;
 }
 
-- 
1.7.5.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-21 12:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-21  8:51 [PATCH 1/2] kvm tools: Fix rbtree-interval balancing Sasha Levin
2011-05-21  8:51 ` [PATCH 2/2] kvm tools: Modify ioport to use interval rbtree Sasha Levin
2011-05-21 10:31   ` Cyrill Gorcunov
2011-05-21 10:55     ` Sasha Levin
2011-05-21 12:08       ` Cyrill Gorcunov
2011-05-21 12:16         ` Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.