From ae5593bb87a6271ac6a8f401ba42245cb473bc79 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 4 Sep 2020 12:12:08 -0400 Subject: [PATCH] maple_tree: remove _mas_data_end, only used in a few places Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9baa67d7b408..c3d8cee4a3b3 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1119,42 +1119,32 @@ done: } /* - * mas_data_end() - Find the end of the data (slot). Sets the value of the - * last pivot to @last_piv. + * mas_data_end() - Find the end of the data (slot). * * @mas - the maple state * @type - the type of maple node - * @last_piv - the final pivot in this node. */ -static inline unsigned char _mas_data_end(const struct ma_state *mas, - const enum maple_type type, unsigned long *last_piv) +static inline unsigned char mas_data_end(const struct ma_state *mas) + { int slot = 0; - unsigned long piv = mas->min, prev_piv = mas->min; + enum maple_type type = mte_node_type(mas->node); + unsigned long piv = mas->min; - for (; slot < mt_slot_count(mas->node); slot++) { + for (; slot < mt_slots[type]; slot++) { piv = _mas_get_safe_pivot(mas, slot, type); if (piv >= mas->max) break; if (!piv && slot) { - piv = prev_piv; slot--; break; } - prev_piv = piv; } - *last_piv = piv; return slot; } -static inline unsigned char mas_data_end(const struct ma_state *mas) -{ - unsigned long l; - - return _mas_data_end(mas, mte_node_type(mas->node), &l); -} /* * mas_leaf_max_gap() - Returns the largest gap in a leaf node * @@ -3259,7 +3249,7 @@ static inline int mas_dead_node(struct ma_state *mas, unsigned long index); */ static inline void mas_prev_node(struct ma_state *mas, unsigned long limit) { - unsigned long pivot, start_piv, last_pivot, min; + unsigned long pivot, start_piv, min; int slot = mas_offset(mas); struct maple_enode *mn; int level; @@ -3311,8 +3301,7 @@ restart_prev_node: mas->node = mn; mas->max = pivot; mas->min = min; - slot = _mas_data_end(mas, mte_node_type(mn), - &last_pivot) + 1; + slot = mas_data_end(mas) + 1; } while (slot-- > 0); ascend: @@ -3725,7 +3714,8 @@ next_slot: goto ascend; mas->node = next; - slot = _mas_data_end(mas, mte_node_type(next), &max); + slot = mas_data_end(mas); + max = mas_get_safe_pivot(mas, slot); } mas_set_offset(mas, slot); -- 2.50.1