From: Liam R. Howlett Date: Sun, 31 Aug 2025 01:10:50 +0000 (-0400) Subject: gap fix for non leaf X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1c9a93682578f9a03c930fe7943315f4c5fb32af;p=users%2Fjedix%2Flinux-maple.git gap fix for non leaf Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a59e95bb6d9e..1829599763c7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3344,11 +3344,22 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas, cp->slot[d] = mt_mk_node(mn, mt); cp->pivot[d] = max; + printk("%p %lx - %lx\n", cp->slot[d], min, max); if (ma_is_leaf(mt)) { cp->gap[d] = ma_leaf_max_gap(mn, mt, min, max, ma_pivots(mn, mt), ma_slots(mn,mt)); - min = max + 1; + printk("New gap for %p = %lx\n", mn, cp->gap[d]); + } else { + unsigned long *gaps = ma_gaps(mn, mt); + + if (gaps) { + unsigned char gap_slot; + + gap_slot = ma_meta_gap(mn); + cp->gap[d] = gaps[gap_slot]; + } } + min = max + 1; } if (sib->end) {