From: Liam R. Howlett Date: Wed, 24 Sep 2025 16:31:25 +0000 (-0400) Subject: drop mas_wr_spanning_rebalance and inline it X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dbe37f4f0e14e0922b6c3ac255293a1462e7980d;p=users%2Fjedix%2Flinux-maple.git drop mas_wr_spanning_rebalance and inline it Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 311fb58d9a5f..8949bf3f66ff 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2874,34 +2874,6 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas, return true; } -static void mas_wr_spanning_rebalance(struct ma_state *mas, - struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas) -{ - struct maple_enode *old_enode; - struct maple_copy cp; - struct ma_state sib; - - /* - * Spanning store is different in that the write is actually from - * l_mas->index to r_mas->last - 1. The -1 is because the last - * was incremented to get to the next node in the case of NULL entries - * being stored to the last slot of the left node. - */ - - cp_leaf_init(&cp, mas, l_wr_mas, r_wr_mas); - do { - spanning_data(&cp, l_wr_mas, r_wr_mas, &sib); - multi_src_setup(&cp, l_wr_mas, r_wr_mas, &sib); - dst_setup(&cp, mas, l_wr_mas->type); - cp_data_write(&cp, mas); - } while (spanning_ascend(&cp, mas, l_wr_mas, r_wr_mas, &sib)); - - old_enode = mas->node; - mas->node = cp.slot[0]; - mas_wmb_replace(mas, old_enode, cp.height); - mtree_range_walk(mas); -} - /* * rebalance_ascend() - Ascend the tree and set up for the next loop - if * necessary @@ -3242,6 +3214,7 @@ static void mas_wr_walk_index(struct ma_wr_state *wr_mas) mas_wr_walk_traverse(wr_mas); } } + /* * mas_extend_spanning_null() - Extend a store of a %NULL to include surrounding %NULLs. * @l_wr_mas: The left maple write state @@ -3384,7 +3357,10 @@ done: */ static void mas_wr_spanning_store(struct ma_wr_state *wr_mas) { + struct maple_enode *old_enode; + struct maple_copy cp; struct ma_state *mas; + struct ma_state sib; /* Left and Right side of spanning store */ MA_STATE(r_mas, NULL, 0, 0); @@ -3441,7 +3417,26 @@ static void mas_wr_spanning_store(struct ma_wr_state *wr_mas) return mas_new_root(mas, wr_mas->entry); } - mas_wr_spanning_rebalance(mas, wr_mas, &r_wr_mas); + + /* + * Spanning store is different in that the write is actually from + * l_mas->index to r_mas->last - 1. The -1 is because the last + * was incremented to get to the next node in the case of NULL entries + * being stored to the last slot of the left node. + */ + + cp_leaf_init(&cp, mas, wr_mas, &r_wr_mas); + do { + spanning_data(&cp, wr_mas, &r_wr_mas, &sib); + multi_src_setup(&cp, wr_mas, &r_wr_mas, &sib); + dst_setup(&cp, mas, wr_mas->type); + cp_data_write(&cp, mas); + } while (spanning_ascend(&cp, mas, wr_mas, &r_wr_mas, &sib)); + + old_enode = mas->node; + mas->node = cp.slot[0]; + mas_wmb_replace(mas, old_enode, cp.height); + mtree_range_walk(mas); } /*