From: Liam R. Howlett Date: Tue, 6 May 2025 16:49:53 +0000 (-0400) Subject: drop unused functions X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a016f487ae631973619d72cca0020632cb08a6d3;p=users%2Fjedix%2Flinux-maple.git drop unused functions Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f462aa159f9b..544c72c983be 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2933,58 +2933,6 @@ new_root: return; } -/* - * mas_rebalance() - Rebalance a given node. - * @mas: The maple state - * @b_node: The big maple node. - * - * Rebalance two nodes into a single node or two new nodes that are sufficient. - * Continue upwards until tree is sufficient. - */ -static inline void mas_rebalance(struct ma_state *mas, - struct maple_big_node *b_node) -{ - char empty_count = mas_mt_height(mas); - struct maple_subtree_state mast; - unsigned char shift, b_end = ++b_node->b_end; - - MA_STATE(l_mas, mas->tree, mas->index, mas->last); - MA_STATE(r_mas, mas->tree, mas->index, mas->last); - - trace_ma_op(__func__, mas); - - /* - * Rebalancing occurs if a node is insufficient. Data is rebalanced - * against the node to the right if it exists, otherwise the node to the - * left of this node is rebalanced against this node. If rebalancing - * causes just one node to be produced instead of two, then the parent - * is also examined and rebalanced if it is insufficient. Every level - * tries to combine the data in the same way. If one node contains the - * entire range of the tree, then that node is used as a new root node. - */ - - mast.orig_l = &l_mas; - mast.orig_r = &r_mas; - mast.bn = b_node; - mast.bn->type = mte_node_type(mas->node); - - l_mas = r_mas = *mas; - - if (mas_next_sibling(&r_mas)) { - mas_mab_cp(&r_mas, 0, mt_slot_count(r_mas.node), b_node, b_end); - r_mas.last = r_mas.index = r_mas.max; - } else { - mas_prev_sibling(&l_mas); - shift = mas_data_end(&l_mas) + 1; - mab_shift_right(b_node, shift); - mas->offset += shift; - mas_mab_cp(&l_mas, 0, shift - 1, b_node, 0); - b_node->b_end = shift + b_end; - l_mas.index = l_mas.last = l_mas.min; - } - - return mas_spanning_rebalance(mas, &mast, empty_count); -} /* * mas_destroy_rebalance() - Rebalance left-most node while destroying the maple @@ -3258,25 +3206,6 @@ void mni_mas_init(struct ma_node_info *mni, struct ma_state *mas) mni_set_end(mni); } -static inline -void mns_mas_init(struct ma_node_state *mns, struct ma_node_info *mni, - struct ma_state *mas) -{ - mni->node = mte_to_node(mas->node); - mni->type = mte_node_type(mas->node); - _mni_node_init(mni, mni->node, mni->type); - mni->enode = mas->node; - mni->end = mas->end; - mni->max = mas->max; - mni->min = mas->min; - - mns->info = mni; - mns->start = 0; - mns->size = 0; - mns->dst = NULL; - mns->use_part = false; -} - static inline void mns_mni_init(struct ma_node_state *mns, struct ma_node_info *dst, unsigned char start, unsigned char len) @@ -3304,30 +3233,6 @@ bool mns_ends_in_null(struct ma_node_state *ns) return true; } -/* FIXME: This comment. - * Parent ma_node_state init - */ -static inline -void mni_pmni_init(struct ma_node_info *mni, struct ma_node_info *pmni, - unsigned char p_off, struct maple_tree *mt) -{ - if (p_off == pmni->end) { - mni->max = pmni->max; - mni->min = pmni->pivots[p_off - 1]; - } else { - mni->max = pmni->pivots[p_off]; - if (p_off) - mni->min = pmni->pivots[p_off - 1]; - else - mni->min = pmni->min; - } - - mni->enode = mt_slot_locked(mt, pmni->slots, p_off); - mni->insert_off = p_off; - _mni_node_init(mni, mte_to_node(mni->enode), - mte_node_type(mni->enode)); -} - /* * @src: The maple node state of the source * @dst: The maple node state of the destination @@ -4238,21 +4143,6 @@ rebalanced: mtree_range_walk(mas); } -/* - * mas_commit_b_node() - Commit the big node into the tree. - * @wr_mas: The maple write state - * @b_node: The maple big node - */ -static noinline_for_kasan void mas_commit_b_node(struct ma_wr_state *wr_mas, - struct maple_big_node *b_node) -{ - enum store_type type = wr_mas->mas->store_type; - - WARN_ON_ONCE(type != wr_rebalance && type != wr_split_store); - - return mas_rebalance(wr_mas->mas, b_node); -} - /* * mas_root_expand() - Expand a root to a node * @mas: The maple state