From: Liam R. Howlett Date: Mon, 22 Sep 2025 19:33:44 +0000 (-0400) Subject: pull min and max into cp_dst_to_slots() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=63bb823b04886c2aa393c721ffdd8bba0b7f31b0;p=users%2Fjedix%2Flinux-maple.git pull min and max into cp_dst_to_slots() Signed-off-by: Liam R. Howlett --- 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;