]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
height fix
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 26 Aug 2025 17:01:43 +0000 (13:01 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 26 Aug 2025 17:01:43 +0000 (13:01 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
include/linux/maple_tree.h
lib/maple_tree.c

index 3ad730c3290edc49fd300d03dd6f3735d2b7ccb6..eb8f55d139b8f9de4d62f5f4dd1c7a81e3a6a3eb 100644 (file)
@@ -193,6 +193,7 @@ struct maple_copy {
        unsigned char d_count;
        unsigned char split;
        unsigned char data;
+       unsigned char height;
 };
 
 /**
index bed750d046c4c72460fd27a5b34ef3720fc2cb5b..eaa0f724cc10cf37694d9b9dd4af0c4528c3b68e 100644 (file)
@@ -3312,6 +3312,7 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas,
                                  cp->dst[0].node, 0, mt);
                        node_finalise(cp->dst[0].node, mt, cp->end);
                        cp->slot[0] = mt_mk_node(cp->dst[0].node, mt);
+                       cp->height++;
                }
 
                printk("CONVERGED\n");
@@ -3526,7 +3527,6 @@ static void mas_wr_spanning_rebalance(struct ma_state *mas,
        struct ma_state sib;
        struct maple_copy cp;
        int debug = 0;
-       unsigned char count = 1;
 
        /*
         * Spanning store is different in that the write is actually from
@@ -3541,8 +3541,8 @@ static void mas_wr_spanning_rebalance(struct ma_state *mas,
        spanning_leaf_init(&cp, mas, l_wr_mas, r_wr_mas);
        do {
                printk("\nlmas %p rmas %p\n", l_wr_mas->node, r_wr_mas->node);
-               count++;
 
+               cp.height++;
                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);
@@ -3555,7 +3555,7 @@ static void mas_wr_spanning_rebalance(struct ma_state *mas,
                for (int i = 0; i < cp.d_count; i++) {
                        printk("dump %p %lx - %lx\n", cp.dst[i].node, min, cp.dst[i].max);
                        mt_dump_node(mas->tree, mt_mk_node(cp.dst[i].node, cp.dst[i].mt),
-                                    min, cp.dst[i].max, count, mt_dump_hex);
+                                    min, cp.dst[i].max, cp.height, mt_dump_hex);
                        min = cp.dst[i].max + 1;
                }
        }
@@ -3567,7 +3567,7 @@ static void mas_wr_spanning_rebalance(struct ma_state *mas,
        old_enode = mas->node;
        mas->node = cp.slot[0];
        printk("Replace %p with %p\n", old_enode, mas->node);
-       mas_wmb_replace(mas, old_enode, count);
+       mas_wmb_replace(mas, old_enode, cp.height);
        mtree_range_walk(mas);
        printk("range at %p[%u]\n", mas->node, mas->offset);
        mt_dump(mas->tree, mt_dump_hex);