From: Liam R. Howlett Date: Tue, 8 Apr 2025 02:00:03 +0000 (-0400) Subject: more printk and dead code X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=31370ce57136a3a43a1db125da4233bbd86aecb2;p=users%2Fjedix%2Flinux-maple.git more printk and dead code Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 990bcf3d68b7e..e7df50bc07035 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3521,45 +3521,6 @@ static __always_inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) return new_end; } -static void mas_wr_split_no_null(struct ma_node_info *src, - struct ma_node_info *left, struct ma_node_info *right, - unsigned char total, struct ma_node_part *ma_part) -{ - if (!ma_is_leaf(src->type)) - return; - - if (!left->slots[left->offset - 1]) { - unsigned char min; - unsigned char end; - - end = total - left->offset; - min = mt_min_slots[right->type]; - if ((end - 1 > min) && - (left->offset < mt_slots[left->type])) { - if (ma_part->unfinished || - src->insert_off == src->offset) { - ma_part->dst_max_off = src->offset; - mni_insert_part(ma_part, left); - } else { - mni_cp(src, left, 1); - } - } else { - left->offset--; - right->offset++; - right->slots[0] = NULL; - if (left->offset < mt_pivots[left->type]) { - right->pivots[0] = left->pivots[left->offset]; - left->pivots[left->offset] = 0; - } else { - right->pivots[0] = left->max; - } - left->max = left->pivots[left->offset - 1]; - } - } - - right->min = left->max + 1; -} - /* * mas_wr_rebalance_calc() - Try to calculate a rebalance that will work * @data_size: The total data to be written @@ -3936,9 +3897,6 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) trace_ma_op(__func__, mas); - printk("\t\t%s\n", __func__); - //mt_dump(mas->tree, mt_dump_dec); - printk ("Store %lu - %lu => %p\n", mas->index, mas->last, wr_mas->entry); height = mas_mt_height(mas); mas->depth = height; @@ -3959,11 +3917,9 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) goto rebalanced; split = (total + 1) / 2; - printk("\t\tSplitting leaf at %u store at %u\n", split, mas->offset); left.min = mas->min; right.max = mas->max; - //mt_dump(wr_mas->mas->tree, mt_dump_dec); i = mt_wr_split_data(&src_info, &left, &right, &ma_part, split, mas->offset, split, 0, wr_mas->offset_end, total, state, 0); @@ -3973,22 +3929,17 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) mni_node_part_init(&ma_part, &left, &right); if (height == 1) { - printk("src parent is %p\n", src_info.node->parent); - printk("New root\n"); goto new_root; } //printk("%d height is %d\n", __LINE__, height); while (--height) { - printk("===================Start of loop\n"); mas_wr_ascend_init(mas, &src_info); - printk("At %p\n", mas->node); mas->end = src_info.end; total = mas->end + 1; if (mas->end + 1 < mt_slots[src_info.type]) goto converged; - //printk("\tConsume %p type %u\n", src.node, src.type); mni_node_init(&left, mas_pop_node(mas), src_info.type); mni_node_init(&right, mas_pop_node(mas), src_info.type); if ((height > 1) && @@ -3998,10 +3949,8 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) left.min = src_info.min; right.max = src_info.max; - printk("MIN %lu MAX %lu\n\n", left.min, right.max); split = (total + 1) / 2; - printk("Split data at %u offset %u\n", split, mas->offset); i = mt_wr_split_data(&src_info, &left, &right, &ma_part, split, mas->offset, split, 0, mas->offset, total, state, 0); @@ -4009,9 +3958,6 @@ static void mas_wr_split(struct ma_wr_state *wr_mas) mni_finalise(&left); mni_finalise(&right); mni_node_part_init(&ma_part, &left, &right); - printk ("part size is %u\n", ma_part.size); - printk("part[1] = %lu\n", ma_part.pivots[1]); - printk("End of loop\n"); } new_root: @@ -4036,7 +3982,6 @@ converged: rebalanced: mas_wmb_replace(mas, src_info.enode); mtree_range_walk(mas); - //mt_dump(wr_mas->mas->tree, mt_dump_dec); } /* @@ -4536,7 +4481,6 @@ done: trace_ma_write(__func__, mas, 0, wr_mas->entry); mas_update_gap(mas); mas->end = new_end; - //mt_dump(mas->tree, mt_dump_hex); return; } @@ -4723,46 +4667,36 @@ static inline void mas_wr_store_entry(struct ma_wr_state *wr_mas) switch (mas->store_type) { case wr_slot_store: - printk("%d\n", __LINE__); mas_wr_slot_store(wr_mas); break; case wr_node_store: - printk("%d\n", __LINE__); mas_wr_node_store(wr_mas, new_end); break; case wr_split_store: - printk("%d\n", __LINE__); mas_wr_split(wr_mas); break; case wr_rebalance: mas_wr_bnode(wr_mas); - printk("%d\n", __LINE__); //mas_wr_rebalance(wr_mas); break; case wr_exact_fit: - printk("%d\n", __LINE__); rcu_assign_pointer(wr_mas->slots[mas->offset], wr_mas->entry); if (!!wr_mas->entry ^ !!wr_mas->content) mas_update_gap(mas); break; case wr_new_root: - printk("%d\n", __LINE__); mas_new_root(mas, wr_mas->entry); break; case wr_store_root: - printk("%d\n", __LINE__); mas_store_root(mas, wr_mas->entry); break; case wr_spanning_store: - printk("%d\n", __LINE__); mas_wr_spanning_store(wr_mas); break; case wr_append: - printk("%d\n", __LINE__); mas_wr_append(wr_mas, new_end); break; case wr_invalid: - printk("%d\n", __LINE__); MT_BUG_ON(mas->tree, 1); return; } @@ -6106,7 +6040,6 @@ int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp) MA_WR_STATE(wr_mas, mas, entry); int ret = 0; - printk("store %lu-%lu\n", index, last); retry: mas_wr_preallocate(&wr_mas, entry); if (unlikely(mas_nomem(mas, gfp))) { @@ -8023,7 +7956,6 @@ counted: MT_BUG_ON(mas->tree, max_gap > mas->max); if (ma_gaps(p_mn, mas_parent_type(mas, mte))[p_slot] != max_gap) { pr_err("gap " PTR_FMT "[%u] != %lu\n", p_mn, p_slot, max_gap); - mt_dump(mas->tree, mt_dump_hex); MT_BUG_ON(mas->tree, 1); } } diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 8e8b6e91fbbf5..db6fe093f711c 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -1305,20 +1305,16 @@ static noinline void __init check_ranges(struct maple_tree *mt) check_load(mt, 11700, xa_mk_value(11700 & LONG_MAX)); /* Cause a 3 child split all the way up the tree. */ for (i = 5; i < 215; i += 10) { - printk("\n\n: START %lu (%lu)\n", 11450 + i, i); check_store_range(mt, 11450 + i, 11450 + i + 1, NULL, 0); - printk("store %lu-%lu => %p\n", 11450 + i, 11450 + i +1); check_load(mt, 11700, xa_mk_value(11700)); mt_validate(mt); - mt_dump(mt, mt_dump_dec); } for (i = 5; i < 65; i += 10) { check_load(mt, 11700, xa_mk_value(11700 & LONG_MAX)); check_store_range(mt, 11770 + i, 11770 + i + 1, NULL, 0); check_load(mt, 11700, xa_mk_value(11700 & LONG_MAX)); mt_validate(mt); - mt_dump(mt, mt_dump_dec); - MT_BUG_ON(mt, mt_height(mt) >= 4); + MT_BUG_ON(mt, mt_height(mt) >= 4); } MT_BUG_ON(mt, mt_height(mt) >= 4); @@ -1326,7 +1322,6 @@ static noinline void __init check_ranges(struct maple_tree *mt) check_store_range(mt, 11700 + i, 11700 + i + 1, NULL, 0); check_load(mt, 11700, xa_mk_value(11700 & LONG_MAX)); mt_validate(mt); - mt_dump(mt, mt_dump_dec); } if (!MAPLE_32BIT) @@ -1370,9 +1365,7 @@ static noinline void __init check_ranges(struct maple_tree *mt) check_store_range(mt, 8084, 8084, xa_mk_value(8084), 0); check_store_range(mt, 8085, 8085, xa_mk_value(8085), 0); /* triple split across multiple levels. */ - mt_dump(mt, mt_dump_dec); check_store_range(mt, 8099, 8100, xa_mk_value(1), 0); - mt_dump(mt, mt_dump_dec); if (!MAPLE_32BIT) MT_BUG_ON(mt, mt_height(mt) != 4); } diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index b7c5d79b44afb..213f028a1eabc 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35452,7 +35452,7 @@ static void check_dfs_preorder(struct maple_tree *mt) count++; mas_dfs_preorder(&mas); } while (!mas_is_none(&mas)); - printk("count %lu vs %lu\n", count, e); + //printk("count %lu vs %lu\n", count, e); MT_BUG_ON(mt, count != e); mtree_destroy(mt);