diff mbox series

[7/7] maple_tree: only ascend left subtree to get the old node for replacement

Message ID 20241127012753.3393-8-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series spanning write related cleanup | expand

Commit Message

Wei Yang Nov. 27, 2024, 1:27 a.m. UTC
When we come to a new_root, we should go up the tree to get the old root
for replacement.

Instead of ascend both left/right subtree, we only ascend one of it is
enough. Let's use the left subtree as it dose now.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 4ba9ae68c0a9..2c05919be168 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2920,7 +2920,7 @@  static void mas_spanning_rebalance(struct ma_state *mas,
 new_root:
 		mas_mn(mast->l)->parent = ma_parent_ptr(mas_tree_parent(mas));
 		while (!mte_is_root(mast->orig_l->node))
-			mast_ascend(mast);
+			mas_ascend(mast->orig_l);
 	} else {
 		mas_mn(&l_mas)->parent = mas_mn(mast->orig_l)->parent;
 	}