From e581c57b13543ae621dd501feec8d24b2300c8b7 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 29 Nov 2024 23:01:13 -0500 Subject: [PATCH] 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 --- lib/maple_tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 326c925f4fc85..fd650cb53fc37 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; -- 2.50.1