]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Optimize mas_reuse_node() loop
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 25 Nov 2020 19:58:09 +0000 (14:58 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:28 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 6d2d71e05759a646f164459ab6b5911d2f2bcdb3..8fbd063d78631fd19fb4e6c9bcd7b0c714f0e201 100644 (file)
@@ -2785,14 +2785,14 @@ static inline bool mas_reuse_node(struct ma_state *mas,
 
        // Zero end of node.
        if (end > bn->b_end) {
-               for (i = bn->b_end + 1; i < mt_slot_count(mas->node); i++) {
+               for (i = bn->b_end + 1; i < mt_pivots[bn->type]; i++) {
                        mte_set_slot(mas->node, i, NULL);
-                       if (i < mt_pivot_count(mas->node))
-                               mte_set_pivot(mas->node, i, 0);
+                       mte_set_pivot(mas->node, i, 0);
 
                //      if (!mte_is_leaf(mas->node) && mt_is_alloc(mas->tree))
                //              mte_set_gap(mas->node, i, 0);
                }
+               mte_set_slot(mas->node, mt_slots[bn->type] - 1, NULL);
 
        }
        return true;