From 868c914004b64891e77dc84d651e7ea67daf2331 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 3 Sep 2025 12:09:47 -0400 Subject: [PATCH] Fix ascending on l and r on the same node Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b31140f48397..636a4d35fd67 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3381,18 +3381,16 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas, while (!mte_is_root(mas->node)) mas_ascend(mas); return false; - } else if (l_wr_mas->mas->node == r_wr_mas->mas->node) { - /* Converged, but caused a cascading split. */ - if (cp->d_count != 1) { - //mt_dump(mas->tree, mt_dump_hex); - //printk("At %p\n", l_wr_mas->mas->node); - //printk("Writing %lx -%lx => %p\n", mas->index, mas->last, l_wr_mas->entry); - } - //WARN_ON_ONCE(cp->d_count != 1); - //cp->dst[0].node->parent = mas_mn(mas)->parent; - //return false; } + /* Converged and has a single destination */ + if ((cp->d_count == 1) && + (l_wr_mas->mas->node == r_wr_mas->mas->node)) { + cp->dst[0].node->parent = ma_parent_ptr(mas_mn(mas)->parent); + return false; + } + + MAS_WR_BUG_ON(l_wr_mas, cp->height > 4); cp->height++; wr_mas_ascend(l_wr_mas); wr_mas_ascend(r_wr_mas); -- 2.51.0