]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wip: pass 747114 - fix r_mas.max when there is no r_mas.max for skipping data
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 24 Jun 2020 00:35:09 +0000 (20:35 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:05:00 +0000 (15:05 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 0081213c1a4f5a3b99a041b4391d79583f8aacd1..ea43f5591951ab2ead8a1b985aba40cba26ca9d5 100644 (file)
@@ -1397,10 +1397,8 @@ static inline void mas_adopt_children(struct ma_state *mas,
 
                child = _mte_get_rcu_slot(parent, slot, type, mas->tree);
                if (!mt_is_empty(child)) {
-                       printk("set parent of child %p slot %u\n", child, slot);
-                       printk("parent is %p\n", parent);
+                       printk("set %p[%u] to parent of %p\n", parent, slot, child);
                        mte_set_parent(child, parent, slot);
-                       printk("%p parent is %p\n", child, mte_parent(child));
                }
        }
 }
@@ -1557,10 +1555,10 @@ static inline void mab_shift_right(struct maple_big_node *b_node,
 static inline int mab_calc_split(struct maple_big_node *b_node, int size,
                                     unsigned char slot_cnt, unsigned long min)
 {
-       int split = (size + 1) / 2; // Assume equal split.
+       int split = size / 2; // Assume equal split.
 
        if (size > 2* slot_cnt) {
-               split = (size + 2) / 3;
+               split = (size + 1) / 3;
        }
 
        printk("Guessing leaf split of %u (size is %d)\n", split, size);
@@ -2672,6 +2670,8 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
                        mab_mas_cp(&b_node, split + 1, b_end + 1, &r_mas, 0);
                        r_mas.max = b_node.pivot[b_end];
                        printk("r_mas.max is %lu\n", r_mas.max);
+               } else {
+                       r_mas.max = l_mas.max;
                }
 
                if (mte_is_leaf(l)) {