]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mas_wr_split() Avoid mas_wr_new_end() call
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Sat, 30 Nov 2024 04:01:13 +0000 (23:01 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 4 Dec 2024 20:36:17 +0000 (15:36 -0500)
ma_part has the size set to what is needed by examining the same data.
Use ma_part.size instead.

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

index fc2da803603dc0e10154c5b3da58469e81a6ac28..7613c0b8e8426cb23e310dd05dc20c8ec5127b41 100644 (file)
@@ -3896,18 +3896,17 @@ static void mas_wr_split(struct ma_wr_state *wr_mas)
        //printk("\t\t%s\n", __func__);
        //mt_dump(mas->tree, mt_dump_hex);
        height = mas_mt_height(mas);
-       /* FIXME: Save this? */
-       total = mas_wr_new_end(wr_mas);
-       split = (total + 1) / 2;
        mas->depth = height;
 
        /* First split the leaves */
        mns_node_init(&left, mas_pop_node(mas), wr_mas->type);
        mns_node_init(&right, mas_pop_node(mas), wr_mas->type);
        mns_mas_init(&src, mas);
-       mns_node_part_leaf_init(&ma_part, wr_mas, &src);
        src.max = mas->max;
        src.min = mas->min;
+       mns_node_part_leaf_init(&ma_part, wr_mas, &src);
+       total = mas->end + ma_part.size - 1;
+       split = (total + 1) / 2;
 
        if (mt_is_alloc(mas->tree))
                right.alloc = left.alloc = true;