From 740181eb1b9f8f35a87d311e4a9c2942a99cfd1b Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 24 Sep 2025 10:26:54 -0400 Subject: [PATCH] more cleanup. Rename multi_dst_setup() to dst_setup() Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 80fc52d785f6..7f479852419b 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2406,7 +2406,7 @@ static inline void cp_leaf_init(struct maple_copy *cp, * @r_wr_mas: The maple write state containing the data to the right of the * write * - * cp->data will not be 0 indexed. + * cp->data is a size (not indexed by 0). */ static inline void cp_data_calc(struct maple_copy *cp, @@ -2448,10 +2448,10 @@ static bool data_fits(struct ma_state *sib, struct ma_state *mas, * * Note that it is still possible to get a full node on the left by the * NULL landing exactly on the split. The NULL ending of a node happens - * in the multi_dst_setup() function, where we will either increase the - * split by one or decrease it by one, if possible. In the case of - * split (this case), it is always possible to shift the spilt by one - - * again because there is at least one slot free by the below checking. + * in the dst_setup() function, where we will either increase the split + * by one or decrease it by one, if possible. In the case of split + * (this case), it is always possible to shift the spilt by one - again + * because there is at least one slot free by the below checking. */ if (new_data < space) return true; @@ -2497,7 +2497,6 @@ static inline void rebalance_data_calc(struct maple_copy *cp, struct ma_wr_state *wr_mas, struct ma_state *sib) { cp_data_calc(cp, wr_mas, wr_mas); - sib->end = 0; if (cp->data >= mt_slots[wr_mas->type]) { push_data_sib(cp, wr_mas->mas, sib); @@ -2512,6 +2511,7 @@ static inline void rebalance_data_calc(struct maple_copy *cp, } return; + use_sib: cp->data += sib->end + 1; } @@ -2524,7 +2524,6 @@ static inline void spanning_data_calc(struct maple_copy *cp, struct ma_state *sib) { cp_data_calc(cp, l_wr_mas, r_wr_mas); - if (((l_wr_mas->mas->min != 0) || (r_wr_mas->mas->max != ULONG_MAX)) && (cp->data <= mt_min_slots[l_wr_mas->type])) { spanning_sib(l_wr_mas, r_wr_mas, sib); @@ -2532,12 +2531,14 @@ static inline void spanning_data_calc(struct maple_copy *cp, } else { sib->end = 0; } - } +/* + * dst_setup() - Set up multiple destinations for the new data. This is + * called when the node is split or rebalanced. + */ static inline -void multi_dst_setup(struct maple_copy *cp, struct ma_state *mas, - enum maple_type mt) +void dst_setup(struct maple_copy *cp, struct ma_state *mas, enum maple_type mt) { /* Data is 1 indexed, every src has +1 added. */ @@ -2785,7 +2786,7 @@ static inline void rebalance_new_root(struct maple_copy *cp, struct ma_state *ma cp->data = cp->d_count; cp->s_count = 0; - multi_dst_setup(cp, mas, mt); + dst_setup(cp, mas, mt); spanning_init_cp_src(cp); node_copy(mas, cp->src[0].node, 0, cp->data, cp->max, maple_copy, cp->dst[0].node, 0, mt); @@ -2853,7 +2854,7 @@ static void mas_wr_spanning_rebalance(struct ma_state *mas, do { spanning_data_calc(&cp, l_wr_mas, r_wr_mas, &sib); multi_src_setup(&cp, l_wr_mas, r_wr_mas, &sib); - multi_dst_setup(&cp, mas, l_wr_mas->type); + 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)); @@ -3729,7 +3730,7 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) do { split_data_calc(&cp, wr_mas, &sib); multi_src_setup(&cp, wr_mas, wr_mas, &sib); - multi_dst_setup(&cp, mas, wr_mas->type); + dst_setup(&cp, mas, wr_mas->type); cp_data_write(&cp, mas); } while (split_ascend(&cp, wr_mas, &sib)); @@ -3773,7 +3774,7 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas) do { rebalance_data_calc(&cp, wr_mas, &sib); multi_src_setup(&cp, wr_mas, wr_mas, &sib); - multi_dst_setup(&cp, mas, wr_mas->type); + dst_setup(&cp, mas, wr_mas->type); cp_data_write(&cp, mas); } while (rebalance_ascend(&cp, wr_mas, &sib)); -- 2.51.0