]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
pull min and max into cp_dst_to_slots()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 22 Sep 2025 19:33:44 +0000 (15:33 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 22 Sep 2025 19:33:44 +0000 (15:33 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 3cecf62c8ed7e479935d61aa980198b324f282ae..b30567e56b81926d7aacc64076324089560e85e7 100644 (file)
@@ -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;