]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
stop using maple_subtree_state
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 21 Aug 2025 21:02:02 +0000 (17:02 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 21 Aug 2025 21:02:02 +0000 (17:02 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 7ef6c481702b8f54516a7c4a9f65071910d11600..9663c02738684efa4ad66d5774fc7c5554fc0b89 100644 (file)
@@ -2272,11 +2272,11 @@ static inline void mast_rebalance_prev(struct maple_subtree_state *mast)
 }
 
 static inline
-bool mas_spanning_move(struct maple_subtree_state *mast,
-                      struct ma_state *nneighbour)
+bool mas_spanning_move(struct ma_wr_state *l_wr_mas,
+               struct ma_wr_state *r_wr_mas, struct ma_state *nneighbour)
 {
-       struct ma_state r_tmp = *mast->orig_r;
-       struct ma_state l_tmp = *mast->orig_l;
+       struct ma_state l_tmp = *l_wr_mas->mas;
+       struct ma_state r_tmp = *r_wr_mas->mas;
        unsigned char depth = 0;
 
        do {
@@ -2958,13 +2958,12 @@ static void mt_dump_node(const struct maple_tree *mt, void *entry,
                enum mt_dump_format format);
 
 static inline void spanning_data_calc(struct maple_copy *cp,
-               struct ma_state *mas, struct maple_subtree_state *mast,
-               struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas,
-               struct ma_state *sib)
+               struct ma_state *mas, struct ma_wr_state *l_wr_mas,
+               struct ma_wr_state *r_wr_mas, struct ma_state *sib)
 {
        /* data from left + new entry */
-       cp->data = mast->orig_l->offset + 1;
-       printk("data size is off %u + 1\n", mast->orig_l->offset);
+       cp->data = l_wr_mas->mas->offset + 1;
+       printk("data size is off %u + 1\n", l_wr_mas->mas->offset);
        printk("write is now %lx - %lx => %p\n", mas->index, mas->last, l_wr_mas->entry);
        /* new entry will overwrite one part of left */
        if (l_wr_mas->r_min == mas->index) {
@@ -2974,11 +2973,11 @@ static inline void spanning_data_calc(struct maple_copy *cp,
                printk("min splits start %lx vs %lx\n", l_wr_mas->r_min, mas->index);
        }
 
-       printk("%p data + 1 = %u\n", mast->orig_l->node, cp->data);
+       printk("%p data + 1 = %u\n", l_wr_mas->mas->node, cp->data);
 
        /* Data from right (offset to end) + 1 for zero, +1 for splitting */
-       cp->data += mast->orig_r->end - mast->orig_r->offset + 2;
-       printk("end %u - off %u + 1\n", mast->orig_r->end, mast->orig_r->offset);
+       cp->data += r_wr_mas->mas->end - r_wr_mas->mas->offset + 2;
+       printk("end %u - off %u + 1\n", r_wr_mas->mas->end, r_wr_mas->mas->offset);
        /* new entry splits the insert location */
        printk("end piv %lx vs last %lx\n", r_wr_mas->r_max, mas->last);
        if (r_wr_mas->r_max == mas->last) {
@@ -2986,11 +2985,11 @@ static inline void spanning_data_calc(struct maple_copy *cp,
                cp->data--;
        }
 
-       printk("%p data = %u\n", mast->orig_r->node, cp->data);
+       printk("%p data = %u\n", r_wr_mas->mas->node, cp->data);
 
-       if (((mast->orig_l->min != 0) || (mast->orig_r->max != ULONG_MAX)) &&
+       if (((l_wr_mas->mas->min != 0) || (r_wr_mas->mas->max != ULONG_MAX)) &&
            (cp->data < mt_min_slots[l_wr_mas->type])) {
-               mas_spanning_move(mast, sib);
+               mas_spanning_move(l_wr_mas, r_wr_mas, sib);
                cp->data += sib->end + 1;
                printk("%p data = %u\n", sib->node, cp->data);
        } else {
@@ -3395,7 +3394,7 @@ static noinline void mas_wr_spanning_rebalance(struct ma_state *mas,
 
        mt_dump(mas->tree, mt_dump_hex);
 
-       spanning_data_calc(&cp, mas, mast, l_wr_mas, r_wr_mas, &sib);
+       spanning_data_calc(&cp, mas, l_wr_mas, r_wr_mas, &sib);
        spanning_split_dest_setup(&cp, mas, l_wr_mas->type);
        spanning_split_src_setup(&cp, mas, l_wr_mas, r_wr_mas, &sib);