From: Liam R. Howlett Date: Wed, 16 Apr 2025 14:53:45 +0000 (-0400) Subject: outline X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f94897ac02d9037d36435f36113fb575637f73ee;p=users%2Fjedix%2Flinux-maple.git outline Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e70e863b4c27c..88467f48b68eb 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3883,6 +3883,7 @@ static void mt_wr_split_data(struct ma_node_info *src, to = left; node_off = 0; /* src */ part_off = 0; + printk("sd off %u in %u in_end %u\n", sd->offset, sd->insert, insert_end); do { unsigned char copied = 0; @@ -3942,6 +3943,7 @@ static void mt_wr_split_data(struct ma_node_info *src, sd->split = 255; } sd->len++; + printk("node off %u src end %u\n", node_off, src->end); } while (node_off <= src->end); } @@ -4075,11 +4077,46 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas) */ mt_dump(mas->tree, mt_dump_dec); + height = mas_mt_height(mas); mas->depth = height; + /* + * allocate left + * set alloc in left + * figure out src2 + * rebalance leaves { + * allocate right, if needed + * set right alloc to left value + * set up split data + * split the data + * set up part + * } + * + * while ( parent is insufficient including overwrite, extra part) { + * allocate left + * figure out src2 + * rebalance src and src 2 { + * allocate right, if needed + * set right alloc to left value + * set up split data + * split the data and insert part + * set up next part + * } + * + * allocate new parent + * converge + * copy to insert + * insert part + * skip entry (or 2) + * copy to end + * put in tree + * + */ + mni_mas_init(&src, mas); tmp_mas = *mas; while (height--) { + printk("height %d\n", height); mas_wr_ascend_init(&tmp_mas, &parent); max = mt_slots[src.type] - 1; if (ma_is_leaf(src.type)) @@ -4163,6 +4200,7 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas) * Absorb all the data from two nodes, which may need * more rebalancing */ + printk("Absorb src %p src2 %p\n", src.node, src2.node); sd.split = sd.new_end + 2; /* No split */ if (!left_store) {