]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fix ascending on l and r on the same node
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 3 Sep 2025 16:09:47 +0000 (12:09 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 3 Sep 2025 16:09:47 +0000 (12:09 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index b31140f4839718476282281e13a20f370e200739..636a4d35fd67f42d78eea1c4d517a73cc106c450 100644 (file)
@@ -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);