From: Liam R. Howlett Date: Sat, 30 Nov 2024 04:01:13 +0000 (-0500) Subject: mas_wr_split() Avoid mas_wr_new_end() call X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cc157b884236cac40c1d0a61e5fc54f31b1928eb;p=users%2Fjedix%2Flinux-maple.git mas_wr_split() Avoid mas_wr_new_end() call 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 --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index fc2da803603d..7613c0b8e842 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;