From 63bb823b04886c2aa393c721ffdd8bba0b7f31b0 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Mon, 22 Sep 2025 15:33:44 -0400 Subject: [PATCH] pull min and max into cp_dst_to_slots() Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 3cecf62c8ed7..b30567e56b81 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3321,7 +3321,7 @@ void cp_data_write(struct maple_copy *cp, struct ma_state *mas) static inline void cp_dst_to_slots(struct maple_copy *cp, unsigned long min, - struct ma_state *mas) + unsigned long max, struct ma_state *mas) { unsigned char d; @@ -3351,6 +3351,9 @@ static inline void cp_dst_to_slots(struct maple_copy *cp, unsigned long min, min = max + 1; } + cp->end = cp->d_count - 1; + cp->min = min; + cp->max = max; } static inline void rebalance_new_root(struct maple_copy *cp, struct ma_state *mas) @@ -3388,11 +3391,7 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas, *r_wr_mas->mas = *sib; } - cp_dst_to_slots(cp, l_wr_mas->mas->min, mas); - cp->end = cp->d_count - 1; - cp->min = l_wr_mas->mas->min; - cp->max = r_wr_mas->mas->max; - + cp_dst_to_slots(cp, l_wr_mas->mas->min, r_wr_mas->mas->max, mas); if (!cp->min && cp->max == ULONG_MAX) { rebalance_new_root(cp, mas); return false; @@ -3469,11 +3468,7 @@ static inline bool rebalance_ascend(struct maple_copy *cp, r = mas; } - cp_dst_to_slots(cp, min, mas); - cp->end = cp->d_count - 1; - cp->min = l->min; - cp->max = r->max; - + cp_dst_to_slots(cp, min, r->max, mas); if (!cp->min && cp->max == ULONG_MAX) { rebalance_new_root(cp, mas); return false; -- 2.51.0