]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Use shortcut for root in cp_is_new_root()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 9 Oct 2025 17:48:47 +0000 (13:48 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 9 Oct 2025 17:48:47 +0000 (13:48 -0400)
Instead of ascending until we reach root, just jump to the root node
from the top.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 4adad4e949029dc236150603f3d8f9cfd8f5d10e..2439879a84cb253d1da235d4fa3a51a01525758d 100644 (file)
@@ -2847,9 +2847,10 @@ static inline bool cp_is_new_root(struct maple_copy *cp, struct ma_state *mas)
        }
        WARN_ON_ONCE(cp->dst[0].node != mte_to_node(cp->slot[0]));
        cp->dst[0].node->parent = ma_parent_ptr(mas_tree_parent(mas));
-       while (!mte_is_root(mas->node))
-               mas_ascend(mas);
-
+       mas->min = 0;
+       mas->max = ULONG_MAX;
+       mas->depth = 0;
+       mas->node = mas_root_locked(mas);
        return true;
 }