]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Remove debug
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 10 Jul 2020 19:07:50 +0000 (15:07 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:05:08 +0000 (15:05 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c
lib/test_maple_tree.c

index 321407fb75f490eb16fa8bae33eba70643b6f73d..b3a6f05d2124dd648c4affb56d56fa4ec7a90318 100644 (file)
@@ -1124,11 +1124,8 @@ static inline unsigned char _mas_data_end(const struct ma_state *mas,
 {
        int slot = 0;
        unsigned long piv = mas->min, prev_piv = mas->min;
-       //printk("starting %lu %lu\n", piv, prev_piv);
-       //printk("  min %lu max %lu\n", mas->min, mas->max);
        for (; slot < mt_slot_count(mas->node); slot++) {
                piv = _mas_get_safe_pivot(mas, slot, type);
-               //printk(" %u %lu\n", slot, piv);
                if (piv >= mas->max)
                        break;
 
@@ -1140,7 +1137,6 @@ static inline unsigned char _mas_data_end(const struct ma_state *mas,
                prev_piv = piv;
        }
 
-//     printk("%s: %u\n", __func__, slot);
        *last_piv = piv;
        return slot;
 }
@@ -1178,7 +1174,6 @@ static inline unsigned long mas_leaf_max_gap(struct ma_state *mas)
 
        pstart = mas->min;
        for (i = 0; i < mt_slots[mt]; i++) {
-               //printk("Checking %u\n", i);
                pend = mas_get_safe_pivot(mas, i);
                if (!pend && i)
                        pend = mas->max;
@@ -1189,9 +1184,6 @@ static inline unsigned long mas_leaf_max_gap(struct ma_state *mas)
                if (!mt_is_empty(entry) || xa_is_retry(entry))
                        goto next;
 
-               //printk("gap %lu in %u\n", gap, i);
-               //printk("%lu - %lu + 1\n", pend, pstart);
-
                if (gap > max_gap)
                        max_gap = gap;
 
@@ -1202,7 +1194,6 @@ next:
                pstart = pend + 1;
        }
 done:
-       //printk("max gap is %lu\n", max_gap);
        return max_gap;
 
 }
@@ -1376,16 +1367,13 @@ void mte_destroy_walk(struct maple_enode *mn, struct maple_tree *mtree)
        unsigned char slot_cnt = mt_slot_count(mn);
        int i;
 
-       printk("%s: %p type %u\n", __func__, mn, type);
        switch (type) {
        case maple_range_16:
        case maple_range_32:
        case maple_range_64:
        case maple_arange_64:
                for (i = 0; i < slot_cnt; i++) {
-                       printk("%s: get slot %u\n", __func__, i);
                        node = mte_get_rcu_slot(mn, i, mtree);
-                       printk("%s: destroy %p\n", __func__, mte_to_node(mn));
                        if (node)
                                mte_destroy_walk(node, mtree);
                }
@@ -1393,7 +1381,6 @@ void mte_destroy_walk(struct maple_enode *mn, struct maple_tree *mtree)
        default:
                break;
        }
-       printk("%s: Free %p (%p)\n", __func__, mte_to_node(mn), mn);
        mte_free(mn);
 
 }
@@ -1413,10 +1400,8 @@ static inline void mas_adopt_children(struct ma_state *mas,
                        break;
 
                child = _mte_get_rcu_slot(parent, slot, type, mas->tree);
-               if (!mt_is_empty(child)) {
-                       printk("set %p[%u] to parent of %p\n", parent, slot, child);
+               if (!mt_is_empty(child))
                        mte_set_parent(child, parent, slot);
-               }
        }
 }
 /* Private
@@ -1435,15 +1420,12 @@ static inline void _mas_replace(struct ma_state *mas, bool free, bool push,
        unsigned char slot = 0;
 
        if (mte_is_root(mas->node)) {
-               printk("It's root\n");
-               printk("New height will be %d\n", mas->depth);
                prev = mas->tree->ma_root;
        } else {
                enum maple_type ptype = mas_parent_enum(mas, mas->node);
 
                parent = mt_mk_node(mte_parent(mas->node), ptype);
                slot = mte_parent_slot(mas->node);
-               printk("Get slot %u of %p\n", slot, parent);
                prev = mte_get_rcu_slot(parent, slot, mas->tree);
        }
 
@@ -1463,7 +1445,6 @@ static inline void _mas_replace(struct ma_state *mas, bool free, bool push,
        }
 
        if (free) {
-               printk("Free %p\n", mte_to_node(prev));
                mte_free(prev);
                return;
        }
@@ -1510,7 +1491,6 @@ static inline struct maple_enode *mas_check_split_parent(struct ma_state *mas,
        if (!entry)
                return NULL;
 
-//     printk("parent of %p[%u] is %p\n", mas_mn(mas), slot, mte_parent(entry));
        if (mte_parent(entry) == entry) {
                printk("%s: Dead node %p", __func__, entry);
                MT_BUG_ON(mas->tree, 1);
@@ -1525,11 +1505,9 @@ static inline struct maple_enode *mas_check_split_parent(struct ma_state *mas,
 static inline struct maple_enode *mas_find_l_split(struct ma_state *mas)
 {
        unsigned char i, end = mas_data_end(mas);
-//     printk("data end of %p was %u\n", mas_mn(mas), end);
        struct maple_enode *en = NULL;
 
        for (i = 0; i <= end; i++) {
-//             printk("%s: Checking %p[%i]\n", __func__, mas_mn(mas), i);
                if ((en = mas_check_split_parent(mas, i)))
                        break;
        }
@@ -1552,10 +1530,8 @@ static inline void mab_shift_right(struct maple_big_node *b_node,
                                 unsigned char shift, bool alloc)
 {
        do {
-//             printk("move %u to %u\n", b_end, b_end + shift);
                b_node->pivot[b_end + shift] = b_node->pivot[b_end];
                b_node->slot[b_end + shift] = b_node->slot[b_end];
-//             printk("piv %u is %lu\n", b_end + shift, b_node->pivot[b_end + shift]);
                if (alloc)
                        b_node->gap[b_end + shift] = b_node->gap[b_end];
        } while (b_end--);
@@ -1589,7 +1565,6 @@ static inline int mab_calc_split(struct maple_big_node *b_node, int size,
 
        /* Avoid ending a node on a NULL entry */
        if (!b_node->slot[split]) {
-               printk("%u is null\n", split);
                if (split < slot_cnt - 1)
                        split++;
                else
@@ -1607,23 +1582,15 @@ static inline int mas_mab_cp(struct ma_state *mas, unsigned char mas_start,
                          unsigned char mab_start)
 {
        int i, j;
-       printk("%s: cp %u - %u\n", __func__, mas_start, mas_end);
        for (i = mas_start, j = mab_start; i <= mas_end; i++, j++) {
-               //printk("cp mas %u\n", i);
                b_node->slot[j] = mas_get_rcu_slot(mas, i);
                if (!mte_is_leaf(mas->node) && mt_is_alloc(mas->tree)) {
                        b_node->gap[j] = mte_get_gap(mas->node, i);
-                       printk("gap %d is %lu\n", j, b_node->gap[j]);
                }
                if (i < mt_pivot_count(mas->node)) {
-                       printk("get safe pivot for %u\n", i);
                        b_node->pivot[j] = mas_get_safe_pivot(mas, i);
-                       printk("Set b_node %u slot %p => piv %lu\n", j,
-                              b_node->slot[j], b_node->pivot[j]);
                } else {
                        b_node->pivot[j] = mas->max;
-                       printk("Set b_node %u slot %p => piv %lu\n", j,
-                              b_node->slot[j], b_node->pivot[j]);
                        j++;
                        break;
                }
@@ -1634,7 +1601,6 @@ static inline int mas_mab_cp(struct ma_state *mas, unsigned char mas_start,
                        break;
                }
        }
-       printk("%s: return %u\n", __func__, j);
        return j;
 }
 
@@ -1643,17 +1609,13 @@ static inline int mab_mas_cp(struct maple_big_node *b_node,
                             struct ma_state *mas, unsigned char mas_start)
 {
        int i, j;
-       printk("%s: cp %u - %u to mas %p\n", __func__, mab_start, mab_end, mas_mn(mas));
        for (i = mab_start, j = mas_start; i <= mab_end; i++, j++) {
-               //printk("i %d end %u\n", i, mab_end);
                if(j && !b_node->pivot[i]) {
-                       printk("no pivot at %u\n", i);
                        break;
                }
 
                mas->max = b_node->pivot[i];
                mte_set_rcu_slot(mas->node, j, b_node->slot[i]);
-               printk("Set %u %lu %p\n", j, b_node->pivot[i], b_node->slot[i]);
                if (j < mt_pivot_count(mas->node))
                        mte_set_pivot(mas->node, j, b_node->pivot[i]);
 
@@ -1684,10 +1646,7 @@ static inline void mas_descend_adopt(struct ma_state *mas)
         * then set the correct parent in all of of the parent's children.
         */
        while (!mte_is_leaf(l_mas.node)) {
-               printk("start of l %p is %p\n", mas_mn(&l_mas), l_mas.node);
-               printk("start of r %p is %p\n", mas_mn(&r_mas), r_mas.node);
                if (!(l_enode = mas_find_l_split(&l_mas))) {
-                       printk("\tChecking right\n");
                        mas_adopt_children(&l_mas, l_mas.node);
                        mas_dup_state(&l_mas, &r_mas);
                        if (!(l_enode = mas_find_l_split(&l_mas))) {
@@ -1696,28 +1655,18 @@ static inline void mas_descend_adopt(struct ma_state *mas)
                        }
                }
 
-               printk("%d New node is %p\n", __LINE__, mte_to_node(l_enode));
-
                if (!(r_enode = mas_find_r_split(&r_mas))) {
-                       printk("\tChecking left\n");
                        mas_adopt_children(&r_mas, r_mas.node);
                        mas_dup_state(&r_mas, &l_mas);
                        r_enode = mas_find_r_split(&r_mas);
                }
-               printk("%d New node is %p\n", __LINE__, mte_to_node(r_enode));
 
-               printk("Adopt children of l %p\n", mas_mn(&l_mas));
                mas_adopt_children(&l_mas, l_mas.node);
-               if (r_mas.node != l_mas.node) {
-                       printk("Adopt children of r %p\n", mas_mn(&r_mas));
+               if (r_mas.node != l_mas.node)
                        mas_adopt_children(&r_mas, r_mas.node);
-               }
+
                mas_descend(&l_mas);
                mas_descend(&r_mas);
-
-               printk("%d New node is %p\n", __LINE__, mas_mn(&l_mas));
-               printk("%d New node is %p\n", __LINE__, mas_mn(&r_mas));
-               printk("\n");
        }
 }
 
@@ -1742,7 +1691,6 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas,
                b_node->pivot[b_end++] = mas->index - 1;
        }
 
-       printk("Store value at %u piv %lu\n", b_end, mas->last);
        b_node->slot[b_end] = entry;
        b_node->pivot[b_end] = mas->last;
 
@@ -1757,15 +1705,11 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas,
        if (piv >= mas->max)
                return b_end;
 
-       printk("slot %u piv %lu\n", slot, piv);
        do {
                piv = mas_get_safe_pivot(mas, ++slot);
        } while ((piv <= mas->last) && (slot <= end));
 
-       printk("slot %u piv %lu\n", slot, piv);
-
        if (piv > mas->last) {
-               printk("Cp %u to %u\n", slot, end);
                if (slot > end) {
                        b_node->slot[++b_end] = NULL;
                        b_node->pivot[b_end] = piv;
@@ -1793,7 +1737,6 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
 
        mas_ascend(mas);
        mas_set_slot(mas, p_slot - 1);
-       printk("%s: going to go to %p[%u]\n", __func__, mas_mn(mas), p_slot - 1);
        mas_descend(mas);
        return true;
 }
@@ -1830,21 +1773,14 @@ mas_consume(struct ma_state *l_mas, struct ma_state *r_mas,
        unsigned char l_slot, r_slot, slot, end;
        unsigned long l_min,  range_min, range_max;
 
-       printk("%s: l %p (%lu) r %p (%lu)\n", __func__, mas_mn(l_mas),
-              l_mas->index, mas_mn(r_mas), r_mas->last);
        // The left node is consumed, so add to the free list.
        free[(*f)++] = l_mas->node;
-       printk("free %u -> %p (%p)\n", (*f)-1, mte_to_node(free[(*f)-1]),
-               free[(*f)-1]);
-
        l_min = l_mas->index;
        l_mas->index = l_mas->last;
-       printk("OVERWRITE index with %lu for search?\n", l_mas->last);
        mas_node_walk(l_mas, mte_node_type(l_mas->node), &range_min, &range_max);
        l_mas->index = l_min;
        l_slot = mas_get_slot(l_mas);
        r_slot = mas_get_slot(r_mas);
-       printk("l_slot %u r_slot %u\n", l_slot, r_slot);
        if (l_mas->node == r_mas->node) {
                /* If the contents up to l_slot and from r_slot to end are
                 * still valid and it's the same node, then the rest may need to
@@ -1852,30 +1788,22 @@ mas_consume(struct ma_state *l_mas, struct ma_state *r_mas,
                 * from the parent in the previous iteration which is still in
                 * use.
                 */
-               printk("Add %p[%u-%u] to discard\n", mas_mn(l_mas), l_slot + 1, r_slot - 1);
-               for (slot = l_slot + 1; slot < r_slot; slot++) {
+               for (slot = l_slot + 1; slot < r_slot; slot++)
                        discard[(*d)++] = mas_get_rcu_slot(l_mas, slot);
-       printk("discard %u -> %p\n", (*d)-1, discard[(*d)-1]);
-               }
                return;
        }
        /* r_mas is different and consumed. */
        free[(*f)++] = r_mas->node;
-       printk("free %u -> %p\n", (*f)-1, free[(*f)-1]);
        if (mte_is_leaf(r_mas->node))
                return;
 
        /* Now free l_slot + 1 -> end and 0 -> r_slot - 1 */
        end = mas_data_end(l_mas);
-       for (slot = l_slot + 1; slot <= end; slot++) {
+       for (slot = l_slot + 1; slot <= end; slot++)
                discard[(*d)++] = mas_get_rcu_slot(l_mas, slot);
-       printk("l discard %u -> %p\n", (*d)-1, discard[(*d)-1]);
-       }
 
-       for (slot = 0; slot < r_slot; slot++) {
+       for (slot = 0; slot < r_slot; slot++)
                discard[(*d)++] = mas_get_rcu_slot(r_mas, slot);
-       printk("r discard %u -> %p (%u of %u)\n", (*d)-1, discard[(*d)-1], slot, r_slot);
-       }
 }
 
 /* Private
@@ -1914,13 +1842,8 @@ static inline int mas_combine_separate(struct ma_state *mas,
        l_mas.node = r_mas.node = m_mas.node = NULL;
        left = right = middle = NULL;
 
-       mt_dump(mas->tree);
-       printk("Starting with orig of %p and %p\n", mas_mn(orig_l_mas),
-              mas_mn(orig_r_mas));
-       printk("\t\t%d %u\n", __LINE__, b_end);
        mas_consume(orig_l_mas, orig_r_mas, free, &i, destroy, &d);
        while(count--) {
-               printk("Iteration %u\n", count);
                b_end--;
                slot_cnt = mt_slot_count(orig_l_mas->node);
                right = NULL;
@@ -1941,7 +1864,6 @@ static inline int mas_combine_separate(struct ma_state *mas,
                if (mab_middle_node(b_node, b_end, slot_cnt))
                        middle = mt_mk_node(ma_mnode_ptr(mas_next_alloc(mas)),
                                            mte_node_type(orig_l_mas->node));
-               printk("Splitting %u at %u\n", b_end, split);
 
                /* Set parents from previous run */
                if (l_mas.node) {
@@ -1976,7 +1898,6 @@ static inline int mas_combine_separate(struct ma_state *mas,
                l_mas.min = orig_l_mas->min;
                mab_mas_cp(b_node, 0, split, &l_mas, 0);
                l_mas.max = b_node->pivot[split];
-               printk("set from split l_mas.max %lu and %lu\n", l_mas.max, l_mas.min);
                r_mas.max = l_mas.max;
 
 
@@ -1987,46 +1908,37 @@ static inline int mas_combine_separate(struct ma_state *mas,
                        m_mas.max = b_node->pivot[split];
                }
                if (right) {
-                       printk("there is a r\n");
                        mab_mas_cp(b_node, 1 + split, b_end, &r_mas, 0);
                        r_mas.min = b_node->pivot[split] + 1;
                        r_mas.max = b_node->pivot[b_end];
-                       printk("r_mas.max from %u\n", b_end);
                }
-///
 
                /* Copy data from next level in the tree to b_node from next iteration */
                memset(b_node, 0, sizeof(struct maple_big_node));
                orig_l_mas->depth++;
 
                if (!l_mas.min && l_mas.max == ULONG_MAX) {
-                       printk("New root detected by range\n");
-
                        mas_mn(&l_mas)->parent = ma_parent_ptr(
                              ((unsigned long)mas->tree | MA_ROOT_PARENT));
                        mas->depth = orig_l_mas->depth;
                        b_end = 0;
-                       printk("orig_l_mas is %p\n", orig_l_mas->node);
                        if (mte_is_root(orig_l_mas->node)) {
-                               printk("Already at root, skipping consumption\n");
                                if ((orig_l_mas->node != mas->node) &&
                                    (l_mas.depth > mas->tree->ma_height)) {
-                                       printk("Adding %p to free list %u\n", mas->node, i);
                                        free[i++] = mas->node;
                                }
                        } else {
-                       //      mas_set_slot(orig_l_mas, 0);
                                do {
                                        mas_ascend(orig_l_mas);
                                        mas_ascend(orig_r_mas);
-                               mas_set_slot(orig_l_mas, 0);
-                               mas_set_slot(orig_r_mas, 0);
-               mas_node_walk(orig_l_mas, mte_node_type(orig_l_mas->node),
-                             &range_min, &range_max);
-               mas_node_walk(orig_r_mas, mte_node_type(orig_r_mas->node),
-                                  &range_min, &range_max);
-                       //              mas_set_slot(orig_r_mas,
-                       //                           mas_data_end(orig_r_mas));
+                                       mas_set_slot(orig_l_mas, 0);
+                                       mas_set_slot(orig_r_mas, 0);
+                                       mas_node_walk(orig_l_mas,
+                                             mte_node_type(orig_l_mas->node),
+                                             &range_min, &range_max);
+                                       mas_node_walk(orig_r_mas,
+                                             mte_node_type(orig_r_mas->node),
+                                             &range_min, &range_max);
                                        mas_consume(orig_l_mas, orig_r_mas,
                                                    free, &i, destroy, &d);
                                } while (!mte_is_root(orig_l_mas->node));
@@ -2040,13 +1952,10 @@ static inline int mas_combine_separate(struct ma_state *mas,
                mas_ascend(orig_r_mas);
                r_end = mas_data_end(orig_r_mas);
 
-               printk("orig_l_mas min is %lu\n", orig_l_mas->min);
                mas_set_slot(orig_r_mas, 0);
                orig_r_mas->index = r_mas.max;
                if (orig_r_mas->last < orig_r_mas->index)
                        orig_r_mas->last = orig_r_mas->index;
-               printk("Update r_mas.max to %lu\n", r_mas.max);
-               printk("R walk %p for %lu\n", mas_mn(orig_r_mas), orig_r_mas->index);
                if (!mas_node_walk(orig_r_mas,
                                   mte_node_type(orig_r_mas->node),
                                   &range_min, &range_max)) {
@@ -2056,60 +1965,45 @@ static inline int mas_combine_separate(struct ma_state *mas,
                        mas_set_slot(orig_r_mas, r_end + 1);
                }
                r_slot = mas_get_slot(orig_r_mas);
-               printk("r_slot is %u\n", r_slot);
 
                mas_set_slot(orig_l_mas, 0);
                orig_l_mas->index = l_mas.min;
-               printk("L walk %p for %lu\n", mas_mn(orig_l_mas), orig_l_mas->index); 
                mas_node_walk(orig_l_mas, mte_node_type(orig_l_mas->node),
                              &range_min, &range_max);
                l_slot = mas_get_slot(orig_l_mas);
 
                b_end = 0;
-               if (l_slot) {
-                       printk("Copy in orig_l_mas %p\n", mas_mn(orig_l_mas));
+               if (l_slot)
                        b_end = mas_mab_cp(orig_l_mas, 0, l_slot - 1, b_node, 0);
-               }
-               printk("Put L %p at %u %lu\n", l_mas.node, b_end, l_mas.max);
+
                child = b_end;
                // Track dead nodes here.
                b_node->slot[b_end] = l_mas.node;
-               if(mt_is_alloc(mas->tree)) {
+               if(mt_is_alloc(mas->tree))
                        b_node->gap[b_end] = mas_find_gap(&l_mas);
-                       printk("gap %u is %lu\n", b_end, b_node->gap[b_end]);
-               }
+
                b_node->pivot[b_end++] = l_mas.max;
-               printk("l_mas max is %lu\n", b_node->pivot[b_end - 1]);
 
                if (middle) {
-                       printk("Put M! %p at %u %lu\n", m_mas.node, b_end, m_mas.max);
                        b_node->slot[b_end] = middle;
-                       if(mt_is_alloc(mas->tree)) {
-                               b_node->gap[b_end] =
-                                       mas_find_gap(&m_mas);
-                               printk("gap %u is %lu\n", b_end, b_node->gap[b_end]);
-                       }
+                       if(mt_is_alloc(mas->tree))
+                               b_node->gap[b_end] = mas_find_gap(&m_mas);
+
                        b_node->pivot[b_end++] = m_mas.max;
                }
 
                if (right) {
-                       printk("Put R %p at %u %lu\n", r_mas.node, b_end, r_mas.max);
                        b_node->slot[b_end] = right;
-                       if(mt_is_alloc(mas->tree)) {
-                               b_node->gap[b_end] =
-                                       mas_find_gap(&r_mas);
-                               printk("gap %u is %lu\n", b_end, b_node->gap[b_end]);
-                       }
+                       if(mt_is_alloc(mas->tree))
+                               b_node->gap[b_end] = mas_find_gap(&r_mas);
+
                        b_node->pivot[b_end++] = r_mas.max;
-                       printk("r_mas max is %lu\n", b_node->pivot[b_end - 1]);
                }
 
                // Copy anything necessary out of the right node.
                if (b_node->pivot[b_end - 1] < orig_r_mas->max) {
-                       printk("Copy in orig_r_mas %p %u-%u\n", mas_mn(orig_r_mas),
-                              r_slot + 1, r_end);
-                       b_end = mas_mab_cp(orig_r_mas, r_slot + 1, r_end, b_node,
-                                          b_end);
+                       b_end = mas_mab_cp(orig_r_mas, r_slot + 1, r_end,
+                                          b_node, b_end);
                        orig_r_mas->last = orig_r_mas->max;
                }
                mas_consume(orig_l_mas, orig_r_mas, free, &i, destroy, &d);
@@ -2119,29 +2013,21 @@ static inline int mas_combine_separate(struct ma_state *mas,
                // Attempt to balance from this parent
                if (b_end - 1 < mt_min_slot_cnt(orig_l_mas->node)) {
                        unsigned char end;
-                       printk("\t merge with other node l is %p r is %p\n",
-                              mas_mn(orig_l_mas), mas_mn(orig_r_mas));
                        if (mas_next_sibling(orig_r_mas)) {
-                               printk("r sibling merger\n");
                                end = mas_data_end(orig_r_mas);
                                b_end = mas_mab_cp(orig_r_mas, 0, end, b_node,
                                                   b_end);
-                               printk("Add free r %p (%p)\n", mas_mn(orig_r_mas),
-                                      orig_r_mas->node);
                                free[i++] = orig_r_mas->node;
                                orig_r_mas->last = orig_r_mas->max;
                                if (!count)
                                        count++;
                        } else if (mas_prev_sibling(orig_l_mas)) {
-                               printk("l sibling merger %p\n", mas_mn(orig_l_mas));
                                end = mas_data_end(orig_l_mas);
                                // shift b_node by prev size
                                mab_shift_right(b_node, b_end - 1, end + 1,
                                                (mt_is_alloc(mas->tree) ? true : false));
                                // copy in prev.
                                mas_mab_cp(orig_l_mas, 0, end, b_node, 0);
-                               printk("Add free l %p (%p)\n", mas_mn(orig_l_mas),
-                                      orig_l_mas->node);
                                free[i++] = orig_l_mas->node;
                                l_mas.min = orig_l_mas->min;
                                orig_l_mas->index = orig_l_mas->min;
@@ -2156,21 +2042,18 @@ static inline int mas_combine_separate(struct ma_state *mas,
                // Ensure there is enough data for the next iteration.
                if (b_end - 1 < mt_min_slot_cnt(orig_l_mas->node)) {
                        unsigned char end;
-                       printk("\tSteal some data b_end = %u\n", b_end);
                        mas_set_slot(orig_r_mas,
                                     mte_parent_slot(orig_r_mas->node));
                        mas_next_node(orig_r_mas, ULONG_MAX);
                        if (!mas_is_none(orig_r_mas)) {
                                // Add r_mas.node to clean_list.
                                // r_mas is now at the next node..
-                               printk("Taking from right\n");
                                end = mas_data_end(orig_r_mas);
                                b_end = mas_mab_cp(orig_r_mas, 0, end,
                                                   b_node, b_end);
                                orig_r_mas->last = orig_r_mas->max;
                                free[i++] = orig_r_mas->node;
                        } else {
-                               printk("Trying left\n");
                                // Put left into right.
                                mas_dup_state(orig_r_mas, orig_l_mas);
                                mas_dup_state(&r_mas, &l_mas);
@@ -2180,8 +2063,6 @@ static inline int mas_combine_separate(struct ma_state *mas,
                                if (mas_is_none(orig_l_mas)) {
                                        // This is going to be a new root of
                                        // only what is in b_node
-                                       printk("%s: %d New root? %u\n",
-                                              __func__, __LINE__, b_end);
                                        mas_dup_state(orig_l_mas, orig_r_mas);
                                        b_end--;
                                        break;
@@ -2201,27 +2082,18 @@ static inline int mas_combine_separate(struct ma_state *mas,
                                free[i++] = orig_l_mas->node;
                                child += end + 1;
                                b_end += end + 1;
-                               printk("b_end is %u\n", b_end);
                        }
                        if (!count)
                                count++;
                }
-               printk("\t\t%d %u\n", __LINE__, b_end);
-               printk("Next\n");
        }
 
        l_mas.node = mt_mk_node(ma_mnode_ptr(mas_next_alloc(mas)),
                                mte_node_type(orig_l_mas->node));
        orig_l_mas->depth++;
 
-       printk("All done making replacement at %p\n", mas_mn(&l_mas));
-       printk("orig is %p\n", mas_mn(orig_l_mas));
-       printk("orig r is %p\n", mas_mn(orig_r_mas));
        //mas_consume(orig_l_mas, orig_r_mas, free, &i, destroy, &d);
        mab_mas_cp(b_node, 0, b_end, &l_mas, 0);
-       printk("\t\t==>Setting parent of %p to %p[%u]\n", left, mas_mn(&l_mas),
-              child);
-
        mte_set_parent(left, l_mas.node, child);
        if (middle)
                mte_set_parent(middle, l_mas.node, ++child);
@@ -2240,9 +2112,7 @@ static inline int mas_combine_separate(struct ma_state *mas,
        mas->depth = orig_l_mas->depth;
 done:
 
-       printk("Going to insert %p\n", mas_mn(&l_mas));
        // Set up mas for insertion.
-       printk("Killing %p (%p)\n", mas_mn(mas), mas->node);
        mas_set_node_dead(mas);
        mas_dup_state(mas, orig_l_mas);
        smp_wmb();
@@ -2252,27 +2122,21 @@ done:
 
 
 
-       mt_dump(mas->tree);
        if (!mte_is_leaf(mas->node))
                mas_descend_adopt(mas);
 
        do {
-               printk("%s: Free %u %p (%p)\n", __func__, i - 1,
-                      mte_to_node(free[i - 1]), free[i - 1]);
                mte_free(free[--i]);
        } while (i);
 
        if (d) {
                do {
-                       printk("%s: destroy %u %p (%p)\n", __func__, d - 1,
-                              mte_to_node(destroy[d - 1]), destroy[d-1]);
                        mte_destroy_walk(destroy[--d], mas->tree);
                } while (d);
        }
 
-       mt_dump(mas->tree);
        if (mte_is_leaf(mas->node))
-           return b_end;
+               return b_end;
 
        if (mt_is_alloc(mas->tree))
                mas_update_gap(mas, false);
@@ -2287,9 +2151,6 @@ static inline int mas_rebalance(struct ma_state *mas,
        char empty = mas->full_cnt * -1;
        unsigned char b_end = 0;
 
-       printk("%s: rebalance %u levels\n", __func__, empty);
-       mt_dump(mas->tree);
-
        mas_node_cnt(mas, 1 + empty * 2);
        if (mas_is_err(mas))
                return 0;
@@ -2315,7 +2176,6 @@ static inline int mas_rebalance(struct ma_state *mas,
                                (mt_is_alloc(mas->tree) ? true : false));
                b_end = mas_mab_cp(&l_mas, 0, mas_data_end(&l_mas), b_node, 0);
                b_end += new_end + 1;
-               printk("b_end is %u\n", b_end);
                l_mas.index = l_mas.last = l_mas.min;
        }
 
@@ -2332,8 +2192,6 @@ static inline int mas_split(struct ma_state *mas,
        int j, i = 0, height = 0;
        struct maple_enode *list[100];
 
-       printk("%s\n", __func__);
-       mt_dump(mas->tree);
        MA_STATE(l_mas, mas->tree, mas->index, mas->last);
        MA_STATE(r_mas, mas->tree, mas->index, mas->last);
        MA_STATE(orig_l_mas, mas->tree, mas->index, mas->last);
@@ -2356,17 +2214,13 @@ static inline int mas_split(struct ma_state *mas,
         * into the highest common ancestor necessary to be modified (which may
         * be a new root).
         */
-       printk("list %u -> %p\n", i, mas_mn(mas));
        list[i++] = mas->node;
-       printk("full cnt = %u\n", mas->full_cnt);
        while (height++ <= mas->full_cnt) {
                struct maple_node *l, *r;
                enum maple_type type = mte_node_type(mas->node);
                unsigned char slot_cnt = mt_slot_count(mas->node); /* should be full. */
                bool cp = true;
 
-               printk("height %d\n", height);
-
                if (height > mas->full_cnt) {
                        // The last node to be created.
                        if (mte_is_root(mas->node)) {
@@ -2389,15 +2243,11 @@ static inline int mas_split(struct ma_state *mas,
                                        mte_set_pivot(ancestor, j,
                                                      b_node->pivot[j]);
                                if (mt_is_alloc(mas->tree)) {
-                                       printk("Set gap %i to %lu\n", j, b_node->gap[j]);
                                        mte_set_gap(ancestor, j,
                                                    b_node->gap[j]);
                                }
                        }
                        // Set the parent for the children.
-                       printk("Placing left %u and right %u in %p\n",
-                              mas_get_slot(&l_mas), mas_get_slot(&r_mas), ancestor);
-                       printk("l %p and r %p\n", mas_mn(&l_mas), mas_mn(&r_mas));
                        mte_set_parent(l_mas.node, ancestor,
                                       mas_get_slot(&l_mas));
                        mte_set_parent(r_mas.node, ancestor,
@@ -2410,18 +2260,14 @@ static inline int mas_split(struct ma_state *mas,
 
                l = ma_mnode_ptr(mas_next_alloc(mas));
                r = ma_mnode_ptr(mas_next_alloc(mas));
-               printk("l = %p\n", l);
-               printk("r - %p\n", r);
 
                mas_dup_state(&l_mas, mas);
                mas_dup_state(&r_mas, mas);
                l_mas.node = mt_mk_node(l, type);
                r_mas.node = mt_mk_node(r, type);
                if (mte_is_leaf(mas->node)) {
-                       printk("Splitting leaf %p\n", mas_mn(mas));
                        split = mab_calc_split(b_node, new_end, slot_cnt,
                                                mas->min, type);
-                       printk("Splitting at %u\n", split);
                        if (split < slot_cnt)
                                j = mab_mas_cp(b_node, 0, split, &l_mas, 0);
                        else
@@ -2430,15 +2276,10 @@ static inline int mas_split(struct ma_state *mas,
                        mte_set_pivot(r_mas.node, 0, r_mas.max);
                        mab_mas_cp(b_node, j, new_end, &r_mas, 0);
 
-                       printk("l_max is %lu\n", l_mas.max);
                        mas_set_slot(&l_mas, mte_parent_slot(mas->node));
-                       printk("l parent slot %u\n", mas_get_slot(&l_mas));
                        r_mas.min = l_mas.max + 1;
-                       printk("r_min is %lu\n", r_mas.min);
 
                        // In the case of empty.
-                       printk("We are missing one here.. end %u split %u\n",
-                              new_end, split);
                        mas_set_slot(&r_mas, mas_get_slot(&l_mas) + 1);
                } else {
                        unsigned char p_slot;
@@ -2452,37 +2293,27 @@ static inline int mas_split(struct ma_state *mas,
 
                        /* internal node split - cut in half for now. */
                        split = slot_cnt / 2;
-                       printk("split is %u %u %u\n", split, mas_get_slot(&l_mas),
-                              mas_get_slot(&r_mas));
                        j = mab_mas_cp(b_node, 0, split, &l_mas, 0);
                        l_mas.max = b_node->pivot[j - 1];
-                       printk("l_mas.max %lu\n", l_mas.max);
                        r_mas.min = l_mas.max + 1;
                        mab_mas_cp(b_node, j, slot_cnt, &r_mas, 0);
                        p_slot = mas_get_slot(&orig_l_mas);
-                       printk("setting parents of %p and %p to %p and %p\n",
-                              mas_mn(&orig_l_mas), mas_mn(&orig_r_mas),
-                              mas_mn(&l_mas), mas_mn(&r_mas));
                        if (p_slot <= split) { // prev left side is on left.
                                mte_set_parent(orig_l_mas.node, l_mas.node,
                                               p_slot);
-                               printk("p_slot of %p is %u\n", orig_l_mas.node, p_slot);
                        }
                        else {
                                mte_set_parent(orig_l_mas.node, r_mas.node,
                                               p_slot - split - 1);
-                               printk("p_slot of %p is %u\n", orig_l_mas.node, p_slot - split - 1);
                        }
 
                        p_slot = mas_get_slot(&orig_r_mas);
                        if (p_slot <= split) {// prev right side is on left.
                                mte_set_parent(orig_r_mas.node, l_mas.node,
                                               p_slot);
-                               printk("p_slot of %p is %u\n", orig_r_mas.node, p_slot);
                        } else {
                                mte_set_parent(orig_r_mas.node, r_mas.node,
                                               p_slot - split - 1);
-                               printk("p_slot of %p is %u\n", orig_r_mas.node, p_slot - split - 1);
                        }
                }
 
@@ -2493,7 +2324,6 @@ static inline int mas_split(struct ma_state *mas,
                else {
                        mas_ascend(mas);
                        mas_set_slot(mas, mte_parent_slot(mas->node));
-                       printk("list %u -> %p\n", i, mas_mn(mas));
                        list[i++] = mas->node;
                }
 
@@ -2502,24 +2332,16 @@ static inline int mas_split(struct ma_state *mas,
                                       b_node, 0);
 
                split = j;
-               printk("Split is %u\n", split);
                b_node->slot[j] = l_mas.node;
-               printk("l_mas %p[%u] piv %lu\n", mas_mn(&l_mas), j, l_mas.max);
                b_node->pivot[j] = l_mas.max;
                mas_set_slot(&l_mas, j);
                if (mt_is_alloc(mas->tree)) {
                        b_node->gap[j] = mas_find_gap(&l_mas);
                        b_node->gap[j + 1] = mas_find_gap(&r_mas);
-                       printk("Setting %p gap to %lu\n",
-                              mas_mn(&l_mas), b_node->gap[j]);
-                       printk("Setting %p gap to %lu\n",
-                              mas_mn(&r_mas), b_node->gap[j+1]);
                }
                b_node->slot[++j] = r_mas.node;
                b_node->pivot[j] = r_mas.max;
                mas_set_slot(&r_mas, j);
-               printk("New right is in %u (%p)\n", j, b_node->slot[j]);
-               printk("piv right is %lu\n", r_mas.max);
                mas_dup_state(&orig_l_mas, &l_mas);
                mas_dup_state(&orig_r_mas, &r_mas);
                if (cp)
@@ -2530,10 +2352,8 @@ static inline int mas_split(struct ma_state *mas,
 
 
        mas->node = ancestor;
-       printk("Using %p (%p)\n", ancestor, mte_to_node(ancestor));
        BUG_ON(mas_is_none(mas));
        // Set the original node as dead
-       printk("%s: Killing orig_mas %p\n", __func__, mte_to_node(list[0]));
        mte_to_node(list[0])->parent = ma_parent_ptr(mte_to_node(list[0]));
        smp_wmb();
 
@@ -2542,17 +2362,12 @@ static inline int mas_split(struct ma_state *mas,
 
        mas_descend_adopt(mas);
        do {
-               printk("%s: Free %u %p (%p)\n", __func__, i - 1,
-                      mte_to_node(list[i - 1]), list[i-1]);
                mte_free(list[--i]);
-               rcu_barrier();
        } while (i);
 
        if (mt_is_alloc(mas->tree))
                mas_update_gap(mas, false);
-       //mt_dump(mas->tree);
-       printk("Start at %p\n", mas_mn(mas));
-       mt_dump(mas->tree);
+
        return 1;
 }
 
@@ -2562,10 +2377,8 @@ static inline int mas_commit_b_node(struct ma_state *mas,
 {
        struct maple_enode *new_node;
 
-       printk("Commit\n");
        if ((end < mt_min_slot_cnt(mas->node)) && !mte_is_root(mas->node) &&
            (mas->tree->ma_height > 1) ) {
-               printk("end %u min slot %u\n", end, mt_min_slot_cnt(mas->node));
                return mas_rebalance(mas, b_node, end);
        }
        else if (end >= mt_slot_count(mas->node))
@@ -2576,12 +2389,9 @@ static inline int mas_commit_b_node(struct ma_state *mas,
                return 0;
 
        new_node = mt_mk_node(mas_next_alloc(mas), mte_node_type(mas->node));
-       printk("Set %p parent to %p\n", mte_to_node(new_node), mas_mn(mas)->parent);
        mte_to_node(new_node)->parent = mas_mn(mas)->parent;
-       printk("going to replace %p\n", mas_mn(mas));
        mas->node = new_node;
 
-       printk("Copy out 0-%u\n", end);
        mab_mas_cp(b_node, 0, end, mas, 0);
        _mas_replace(mas, true, false, true);
        if (mt_is_alloc(mas->tree))
@@ -2604,7 +2414,6 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry)
        if (mas_is_err(mas))
                return 0;
 
-       printk("\tExpand\n");
        mas->node = mt_mk_node(mas_next_alloc(mas), mt);
        mas_mn(mas)->parent = ma_parent_ptr(
                      ((unsigned long)mas->tree | MA_ROOT_PARENT));
@@ -2930,7 +2739,7 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
 {
        unsigned long range_min, range_max;
        unsigned char b_end = 0; // big_node end.
-       unsigned char count = 0, left, right;
+       unsigned char count = 0;
        struct maple_big_node b_node;
        int node_cnt = 0;
 
@@ -2939,8 +2748,6 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
        MA_STATE(r_mas, mas->tree, mas->index, mas->index);
 
        // Leaf nodes
-       printk("%s: %d\n", __func__, __LINE__);
-
        if (mas->full_cnt > 0)
                node_cnt = 1 + mas->full_cnt * 2; // For split upwards.
        else
@@ -2950,23 +2757,15 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
         * two for every level below the split location.
         */
        node_cnt += 2 + (mas->tree->ma_height - mas->depth) * 2;
-
-       printk("Node_cnt is %u (%u - %u) * 2  with full %d\n", node_cnt,
-              mas->tree->ma_height, mas->depth, mas->full_cnt);
-
        mas_node_cnt(mas, node_cnt);
        if (mas_is_err(mas))
                return 0;
 
-       //mt_dump(mas->tree);
        mas_dup_state(&l_mas, mas);
        mas->last = mas->index;
        mas_node_walk(mas, mte_node_type(mas->node), &range_min, &range_max);
-       left = mas_get_slot(mas);
        mas->index = mas->last = l_mas.last;
        mas_node_walk(mas, mte_node_type(mas->node), &range_min, &range_max);
-       right = mas_get_slot(mas);
-       printk("-->Copy node %p and free %u-%u\n", mte_to_node(mas->node), left, right);
 
        mas_dup_state(mas, &l_mas);
 
@@ -2989,8 +2788,6 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
                mas->last = l_mas.last = r_mas.index = r_mas.last;
                mas_set_slot(mas, mas_get_slot(&l_mas));
        }
-       printk("%s: final range is %lu-%lu at slot %u\n", __func__,
-              mas->index, mas->last, mas_get_slot(&l_mas));
 
 
        // Copy l_mas and store the value in b_node.
@@ -3005,13 +2802,10 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
        count = mas_cnt_positive(mas) + mas->tree->ma_height - mas->depth + 1;
 
        // Combine l_mas and r_mas and split them up evenly again.
-       printk("b_end start is %u and count is %u\n", b_end, count);
        l_mas.depth = 0;
        b_end = mas_combine_separate(mas, &l_mas, &r_mas, &b_node, b_end,
                             count);
 
-       //mt_dump(mas->tree);
-       printk("%s: complete\n", __func__);
        return b_end;
 }
 
@@ -3025,10 +2819,6 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
 
        int ret = 0;
 
-       printk("\nStart: %s %d store %lu-%lu %p\n", __func__, __LINE__,
-              mas->index, mas->last, entry);
-
-       //mt_dump(mas->tree);
        if (mas_start(mas) || (mas_is_none(mas) || mas->node == MAS_ROOT))
                        ret = ma_root_ptr(mas, entry, content, overwrite);
 
@@ -3044,12 +2834,10 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
            !mas->span_enode) {
                /* Not a leaf or spanning write. = broken tree. */
                // FIXME, rebuild?
-               printk("%s %d\n", __func__, __LINE__);
                return NULL;
        }
 
        if (mas->span_enode) {
-               printk("%s %d\n", __func__, __LINE__);
                if (!overwrite) {
                        mas_set_err(mas, -EEXIST);
                        return NULL; // spanning writes always overwrite something.
@@ -3073,21 +2861,16 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
        if (!entry) {
                mas_extend_null(mas, mas);
                slot = mas_get_slot(mas);
-               printk("store is now %lu-%lu at slot %u\n", mas->index,
-                      mas->last, mas_get_slot(mas));
        }
 
        memset(&b_node, 0, sizeof(struct maple_big_node));
-       printk("Copy %p 0-%u\n", mas_mn(mas), slot);
        mas_set_slot(mas, slot);
        new_end = mas_store_b_node(mas, &b_node, entry);
-       printk("new_end is %u\n", new_end);
 
        // Check if this is an append operation.
        end = mas_data_end(mas);
        if ((new_end < slot_cnt) && ((slot > end) || !end)) {
                // Appending
-               printk("Appending to %p[%u] %lu\n", mas_mn(mas), slot, mas->index);
                if (r_min < mas->index)
                        mte_set_pivot(mas->node, slot++, mas->index - 1);
 
@@ -3102,8 +2885,6 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
        else if (new_end < mt_min_slot_cnt(mas->node))
                 mas_cnt_empty(mas);
 
-       printk("End %u new_end %u slot_cnt %u\n", end, new_end, slot_cnt);
-
        mas_commit_b_node(mas, &b_node, new_end);
        if (mas_is_err(mas))
                ret = 3;
@@ -3116,7 +2897,6 @@ done:
                return NULL;
 
 
-       //mt_dump(mas->tree);
        return content;
 }
 void *mas_store(struct ma_state *mas, void *entry)
@@ -3339,7 +3119,6 @@ static inline unsigned long mas_next_node(struct ma_state *mas,
        unsigned long start_piv;
 
 restart_next_node:
-       //printk("%s: %d %p\n", __func__, __LINE__, mas_mn(mas));
        level = 0;
        while (1) {
                unsigned char count;
@@ -3352,7 +3131,6 @@ restart_next_node:
 
                mn = mas->node;
                slot = mas_get_slot(mas);
-               //printk("slot is %u\n", slot);
                start_piv = mas_get_safe_pivot(mas, slot);
                level++;
                mas_ascend(mas);
@@ -3383,10 +3161,7 @@ restart_next_node:
                        if (level == 1) {
                                mas_set_slot(mas, slot);
                                mas->node = mn;
-                               printk("Found node %p\n", mas_mn(mas));
                                if (mas_dead_node(mas, start_piv)) {
-                                       printk("it's dead\n");
-                                       MT_BUG_ON(mas->tree, 1);
                                        goto restart_next_node;
                                }
                                return pivot;
@@ -3513,13 +3288,10 @@ static inline void* mas_last_entry(struct ma_state *mas,
        prev_min = mas->min;
        prev_max = mas->max;
        while (range_start < limit) {
-               printk("start %p\n", mas_mn(mas));
                mas_set_slot(mas, slot);
                if (!mas_next_nentry(mas, limit, &range_start)) {
-                       printk("no next.. slot %u\n", slot);
                        void *entry = mas_get_rcu_slot(mas, slot - 1);
                        if (mte_is_leaf(mas->node)) {
-                               printk("leaf at slot %u\n", slot);
                                mas->index = range_start - 1;
                                mas->index = mte_get_pivot(mas->node, slot - 1);
                                return entry;
@@ -3609,13 +3381,10 @@ static inline void* _mas_prev(struct ma_state *mas, unsigned long limit)
        unsigned char slot;
 
        while (!mas_is_none(mas)) {
-               if (mas_prev_nentry(mas, limit, &max)) {
-                       printk("prev_nentry is %p\n", mas_mn(mas));
+               if (mas_prev_nentry(mas, limit, &max))
                        break;
-               }
 
                mas_prev_node(mas, limit);
-               printk("prev_node is %p\n", mas_mn(mas));
                mas_set_slot(mas, mt_slot_count(mas->node));
        }
 
@@ -3646,10 +3415,8 @@ void *mas_prev(struct ma_state *mas, unsigned long min)
        if (!mas->node)
                mas->node = MAS_START;
 
-       printk("Prev of %p\n", mas_mn(mas));
        if (mas_is_start(mas)) {
                mas_start(mas);
-               printk("Get last entry %p\n", mas_mn(mas));
                return mas_last_entry(mas, ULONG_MAX);
        }
 
@@ -3818,7 +3585,6 @@ static inline bool _mas_awalk(struct ma_state *mas, unsigned long size)
 
        type = mte_node_type(mas->node);
        pivot_cnt = mt_pivots[type];
-       printk("%d %p[%u]\n", __LINE__, mas_mn(mas), mas_get_slot(mas));
 
        switch (type) {
        case maple_leaf_64:
@@ -3828,7 +3594,6 @@ static inline bool _mas_awalk(struct ma_state *mas, unsigned long size)
 
                        pivot = _mas_get_safe_pivot(mas, i, type);
 
-               printk("%d %p[%u] %lu\n", __LINE__, mas_mn(mas), i, pivot);
                        /* End of data in this leaf */
                        if (i && !pivot) {
                                if (min > mas->max)
@@ -3875,7 +3640,6 @@ next:
                for (; i <= pivot_cnt; i++) {
                        unsigned long this_gap;
                        pivot = _mas_get_safe_pivot(mas, i, type);
-               printk("%d %p[%u] %lu\n", __LINE__, mas_mn(mas), i, pivot);
                        if (i && !pivot)
                                goto ascend;
 
@@ -3889,7 +3653,6 @@ next:
 
                        min = pivot + 1;
                        if (mas->last < min) {
-                               printk("%lu < %lu\n", mas->last, min);
                                mas_set_err(mas, -EBUSY);
                                return true;
                        }
@@ -3908,7 +3671,6 @@ descend:
 
        if (!ma_is_leaf(type)) { //descend
                struct maple_enode *next;
-               printk("%d %p\n", __LINE__, mas_mn(mas));
 
                next = mas_get_rcu_slot(mas, i);
                mas->min = min;
@@ -3929,7 +3691,6 @@ ascend:
                found = true;
 
        mas_set_slot(mas, i);
-       printk("found %s\n", found ? "yes": "no");
        return found;
 }
 
@@ -4118,7 +3879,6 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size)
         * found the gap. (return, slot != MAPLE_NODE_SLOTS)
         */
        while (!mas_is_err(mas) && !_mas_awalk(mas, size)) {
-               printk("%d mas node is %p last %p\n", __LINE__, mas_mn(mas), last);
                if (last == mas->node)
                        mas_skip_node(mas);
                else
@@ -4224,19 +3984,14 @@ static inline int _mas_get_unmapped_area(struct ma_state *mas,
        mas->index = min;
        mas->last = max;
 
-       printk("%d mas node is %p walk %lu-%lu for %lu\n", __LINE__,
-              mas_mn(mas), mas->index, mas->last, size);
        if (forward)
                mas_awalk(mas, size);
        else
                mas_rev_awalk(mas, size);
 
-       printk("%d mas node is %p\n", __LINE__, mas_mn(mas));
 
-       if (mas_is_err(mas)) {
-               printk("error is %u\n", xa_err(mas->node));
+       if (mas_is_err(mas))
                return xa_err(mas->node);
-       }
 
        if (mas_get_slot(mas) == MAPLE_NODE_SLOTS)
                return -EBUSY;
@@ -4528,7 +4283,6 @@ static inline bool mas_skip_node(struct ma_state *mas)
        unsigned char slot;
 
        do {
-               printk("Skip node %p\n", mas_mn(mas));
                if (mte_is_root(mas->node)) {
                        slot = mas_get_slot(mas);
                        if (slot > mt_slot_count(mas->node) - 1) {
@@ -4537,15 +4291,12 @@ static inline bool mas_skip_node(struct ma_state *mas)
                        }
                } else {
                        slot = mte_parent_slot(mas->node);
-                       printk("skip parent slot %u\n", slot);
                        mas_ascend(mas);
-                       printk("%d mas node is %p\n", __LINE__, mas_mn(mas));
                }
        } while (slot > mt_slot_count(mas->node) - 1);
 
        mas_set_slot(mas, ++slot);
        mas_update_limits(mas, slot, mte_node_type(mas->node));
-       printk("%d mas node is %p\n", __LINE__, mas_mn(mas));
        return true;
 }
 /* Private
@@ -4560,10 +4311,8 @@ static inline void *mas_erase(struct ma_state *mas)
        unsigned long r_max, r_min;
        void *entry = NULL;
 
-       printk("Start: erase %lu\n", mas->index);
        entry = mas_range_load(mas, &r_min, &r_max, true);
 retry:
-       printk("Erase %lu-%lu\n", r_min, r_max);
        mas->node = MAS_START;
        mas->index = r_min;
        mas->last = r_max;
@@ -5172,7 +4921,6 @@ static inline void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
        unsigned long p_min, p_max;
 
        mas_set_slot(mas, mte_parent_slot(mas->node));
-       printk("next node from %p\n", mas_mn(mas));
        mas_next_node(mas, max);
        if (mas->node != MAS_NONE)
                return;
index f374b070ab65fdc20ef0b44b5b514a02d2c2a1df..6632772370c792ca2a2fcb93348096860ed54102 100644 (file)
@@ -605,7 +605,6 @@ static noinline void check_find_2(struct maple_tree *mt)
                mas_for_each(&mas, entry, ULONG_MAX) {
                        if (mas_retry(&mas, entry))
                                continue;
-                       printk("Checking %lu\n", j);
                        MT_BUG_ON(mt, entry != xa_mk_value(j));
                        j++;
                }
@@ -880,7 +879,7 @@ static noinline void check_erase_testset(struct maple_tree *mt)
                  (((x) == SNULL) ? \
                  "SNULL" : "ERASE") \
        )
-#define check_erase2_debug 2
+#define check_erase2_debug 0
 void *mas_next(struct ma_state *mas, unsigned long max);
 static noinline void check_erase2_testset(struct maple_tree *mt,
                unsigned long *set, unsigned long size)
@@ -30299,7 +30298,8 @@ static noinline void check_alloc_range(struct maple_tree *mt)
        int req_range_cnt = ARRAY_SIZE(req_range);
 
        for (i = 0; i < range_cnt; i += 2) {
-#if 1
+#define DEBUG_ALLOC_RANGE 0
+#if DEBUG_ALLOC_RANGE
                pr_debug("\tInsert %lu-%lu\n", range[i] >> 12,
                         (range[i + 1] >> 12) - 1);
                mt_dump(mt);
@@ -30313,8 +30313,11 @@ static noinline void check_alloc_range(struct maple_tree *mt)
        MA_STATE(mas, mt, 0, 0);
        unsigned long min = 0x565234af2000;
        for (i = 0; i < ARRAY_SIZE(holes); i+= 3) {
+
+#if DEBUG_ALLOC_RANGE
                pr_debug("\tGet unmapped %lu-%lu size %lu\n", min >> 12,
                        holes[i+1] >> 12, holes[i+2] >> 12);
+#endif
                MT_BUG_ON(mt, mas_get_unmapped_area(&mas, min >> 12,
                                        holes[i+1] >> 12,
                                        holes[i+2] >> 12));
@@ -30323,7 +30326,7 @@ static noinline void check_alloc_range(struct maple_tree *mt)
                mas_reset(&mas);
        }
        for (i = 0; i < req_range_cnt; i += 5) {
-#if 1
+#if DEBUG_ALLOC_RANGE
                pr_debug("\tTest %d: %lu-%lu size %lu expected %lu\n", i/5,
                                req_range[i]   >> 12,
                                req_range[i + 1]   >> 12,
@@ -30382,8 +30385,6 @@ static noinline void check_ranges(struct maple_tree *mt)
        check_seq(mt, 200, false);
        // Store 45-168
        check_store_range(mt, r[10], r[11], xa_mk_value(r[10]), 0);
-       mt_dump(mt);
-       printk("Destroying after tc\n");
        mtree_destroy(mt);
 
        check_seq(mt, 30, false);
@@ -30537,9 +30538,7 @@ static noinline void check_ranges(struct maple_tree *mt)
                int val2 = (i+1)*10;
                check_store_range(mt, val, val2, xa_mk_value(val), 0);
        }
-       mt_dump(mt);
        check_store_range(mt, 4600, 4959, xa_mk_value(1), 0);
-       mt_dump(mt);
        mt_validate(mt);
        mtree_destroy(mt);
 
@@ -30605,7 +30604,6 @@ static noinline void check_gap_combining(struct maple_tree *mt)
        entry = mas_find(&mas, ULONG_MAX);
        MT_BUG_ON(mt, entry != xa_mk_value(index));
        mn1 = mas.node;
-       printk("node %p\n", mn1);
        mas_next(&mas, ULONG_MAX);
        entry = mas_next(&mas, ULONG_MAX);
        MT_BUG_ON(mt, entry != xa_mk_value(index + 4));