From: Liam R. Howlett Date: Wed, 3 Sep 2025 16:09:47 +0000 (-0400) Subject: Fix ascending on l and r on the same node X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=868c914004b64891e77dc84d651e7ea67daf2331;p=users%2Fjedix%2Flinux-maple.git Fix ascending on l and r on the same node Signed-off-by: Liam R. Howlett --- 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);