From: Liam R. Howlett Date: Thu, 21 Aug 2025 21:02:43 +0000 (-0400) Subject: add dummy loop X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a97c446621abda7c6c7b44c0ff7a95fc697b0f88;p=users%2Fjedix%2Flinux-maple.git add dummy loop Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9663c0273868..3b59c77cf9e3 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3084,7 +3084,9 @@ void spanning_split_src_setup(struct maple_copy *cp, struct ma_state *mas, } } } -static void spanning_data_write(struct maple_copy *cp, struct ma_state *mas) + +static inline +void spanning_data_write(struct maple_copy *cp, struct ma_state *mas) { struct maple_node *dst, *src; unsigned char s, d; @@ -3197,6 +3199,16 @@ static void spanning_data_write(struct maple_copy *cp, struct ma_state *mas) } while (data_offset <= data); } +static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas, + struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas) +{ + return false; /* for now */ + + if (cp->d_count == 1) /* Converged to one node */ + return false; + +} + static void mas_spanning_rebalance_loop(struct ma_state *mas, struct maple_subtree_state *mast, unsigned char count) { @@ -3394,12 +3406,12 @@ static noinline void mas_wr_spanning_rebalance(struct ma_state *mas, mt_dump(mas->tree, mt_dump_hex); - 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); - - - spanning_data_write(&cp, mas); + do { + 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); + spanning_data_write(&cp, mas); + } while (spanning_ascend(&cp, mas, l_wr_mas, r_wr_mas)); memset(&b_node, 0, sizeof(struct maple_big_node)); /* Copy l_mas and store the value in b_node. */ @@ -3411,10 +3423,10 @@ static noinline void mas_wr_spanning_rebalance(struct ma_state *mas, if (mast->orig_r->max > mast->orig_r->last) { mas_mab_cp(mast->orig_r, mast->orig_r->offset, mast->orig_r->end, &b_node, b_node.b_end + 1); - printk("big node end %u\n", b_node.b_end); + printk("big node end %u\n", b_node.b_end); } else { b_node.b_end++; - printk("big node ++ end %u\n", b_node.b_end); + printk("big node ++ end %u\n", b_node.b_end); } @@ -3446,7 +3458,7 @@ static noinline void mas_wr_spanning_rebalance(struct ma_state *mas, #endif mast_spanning_rebalance(mast); #if 0 - printk("big node end sib %u\n", b_node.b_end); + printk("big node end sib %u\n", b_node.b_end); if (mast->orig_l->node == sib.node) printk("left\n"); else if (mast->orig_r->node == sib.node) @@ -3471,13 +3483,13 @@ static noinline void mas_wr_spanning_rebalance(struct ma_state *mas, { unsigned long min = mas->min; printk("Count is %u\n", cp.d_count); - for (int i = 0; i < cp.d_count; i++) { - printk("dump %p %lu - %lu\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, height, mt_dump_hex); - min = cp.dst[i].max + 1; - } - printk ("VS\n"); + for (int i = 0; i < cp.d_count; i++) { + printk("dump %p %lu - %lu\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, height, mt_dump_hex); + min = cp.dst[i].max + 1; + } + printk ("VS\n"); } #endif mas_spanning_rebalance_loop(mas, mast, height);