]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
gap fix for non leaf
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Sun, 31 Aug 2025 01:10:50 +0000 (21:10 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Sun, 31 Aug 2025 01:10:50 +0000 (21:10 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index a59e95bb6d9e9eaed4540b31ce16561d8a839219..1829599763c744d01b78d4304f4a30f3470ccf4e 100644 (file)
@@ -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) {