From: Liam R. Howlett Date: Tue, 26 Aug 2025 17:01:43 +0000 (-0400) Subject: height fix X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3e4421fe55f22473bb509db4085c97e310c3551c;p=users%2Fjedix%2Flinux-maple.git height fix Signed-off-by: Liam R. Howlett --- diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 3ad730c3290e..eb8f55d139b8 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -193,6 +193,7 @@ struct maple_copy { unsigned char d_count; unsigned char split; unsigned char data; + unsigned char height; }; /** diff --git a/lib/maple_tree.c b/lib/maple_tree.c index bed750d046c4..eaa0f724cc10 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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);