diff mbox series

[RESEND,8/8] maple_tree: drop mas_first_entry()

Message ID 20230707101057.29326-9-zhangpeng.00@bytedance.com (mailing list archive)
State New
Headers show
Series Improve the validation for maple tree and some cleanup | expand

Commit Message

Peng Zhang July 7, 2023, 10:10 a.m. UTC
The internal function mas_first_entry() is no longer used, so drop it.

Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
---
 lib/maple_tree.c | 72 ------------------------------------------------
 1 file changed, 72 deletions(-)

Comments

Liam R. Howlett July 7, 2023, 3:19 p.m. UTC | #1
* Peng Zhang <zhangpeng.00@bytedance.com> [230707 06:11]:
> The internal function mas_first_entry() is no longer used, so drop it.
> 
> Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

> ---
>  lib/maple_tree.c | 72 ------------------------------------------------
>  1 file changed, 72 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 8c08bfdc99cf..ad6810ed3231 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -6662,78 +6662,6 @@ static inline struct maple_enode *mas_get_slot(struct ma_state *mas,
>  			offset);
>  }
>  
> -
> -/*
> - * mas_first_entry() - Go the first leaf and find the first entry.
> - * @mas: the maple state.
> - * @limit: the maximum index to check.
> - * @*r_start: Pointer to set to the range start.
> - *
> - * Sets mas->offset to the offset of the entry, r_start to the range minimum.
> - *
> - * Return: The first entry or MAS_NONE.
> - */
> -static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn,
> -		unsigned long limit, enum maple_type mt)
> -
> -{
> -	unsigned long max;
> -	unsigned long *pivots;
> -	void __rcu **slots;
> -	void *entry = NULL;
> -
> -	mas->index = mas->min;
> -	if (mas->index > limit)
> -		goto none;
> -
> -	max = mas->max;
> -	mas->offset = 0;
> -	while (likely(!ma_is_leaf(mt))) {
> -		MAS_WARN_ON(mas, mte_dead_node(mas->node));
> -		slots = ma_slots(mn, mt);
> -		entry = mas_slot(mas, slots, 0);
> -		pivots = ma_pivots(mn, mt);
> -		if (unlikely(ma_dead_node(mn)))
> -			return NULL;
> -		max = pivots[0];
> -		mas->node = entry;
> -		mn = mas_mn(mas);
> -		mt = mte_node_type(mas->node);
> -	}
> -	MAS_WARN_ON(mas, mte_dead_node(mas->node));
> -
> -	mas->max = max;
> -	slots = ma_slots(mn, mt);
> -	entry = mas_slot(mas, slots, 0);
> -	if (unlikely(ma_dead_node(mn)))
> -		return NULL;
> -
> -	/* Slot 0 or 1 must be set */
> -	if (mas->index > limit)
> -		goto none;
> -
> -	if (likely(entry))
> -		return entry;
> -
> -	mas->offset = 1;
> -	entry = mas_slot(mas, slots, 1);
> -	pivots = ma_pivots(mn, mt);
> -	if (unlikely(ma_dead_node(mn)))
> -		return NULL;
> -
> -	mas->index = pivots[0] + 1;
> -	if (mas->index > limit)
> -		goto none;
> -
> -	if (likely(entry))
> -		return entry;
> -
> -none:
> -	if (likely(!ma_dead_node(mn)))
> -		mas->node = MAS_NONE;
> -	return NULL;
> -}
> -
>  /* Depth first search, post-order */
>  static void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
>  {
> -- 
> 2.20.1
> 
>
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 8c08bfdc99cf..ad6810ed3231 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -6662,78 +6662,6 @@  static inline struct maple_enode *mas_get_slot(struct ma_state *mas,
 			offset);
 }
 
-
-/*
- * mas_first_entry() - Go the first leaf and find the first entry.
- * @mas: the maple state.
- * @limit: the maximum index to check.
- * @*r_start: Pointer to set to the range start.
- *
- * Sets mas->offset to the offset of the entry, r_start to the range minimum.
- *
- * Return: The first entry or MAS_NONE.
- */
-static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn,
-		unsigned long limit, enum maple_type mt)
-
-{
-	unsigned long max;
-	unsigned long *pivots;
-	void __rcu **slots;
-	void *entry = NULL;
-
-	mas->index = mas->min;
-	if (mas->index > limit)
-		goto none;
-
-	max = mas->max;
-	mas->offset = 0;
-	while (likely(!ma_is_leaf(mt))) {
-		MAS_WARN_ON(mas, mte_dead_node(mas->node));
-		slots = ma_slots(mn, mt);
-		entry = mas_slot(mas, slots, 0);
-		pivots = ma_pivots(mn, mt);
-		if (unlikely(ma_dead_node(mn)))
-			return NULL;
-		max = pivots[0];
-		mas->node = entry;
-		mn = mas_mn(mas);
-		mt = mte_node_type(mas->node);
-	}
-	MAS_WARN_ON(mas, mte_dead_node(mas->node));
-
-	mas->max = max;
-	slots = ma_slots(mn, mt);
-	entry = mas_slot(mas, slots, 0);
-	if (unlikely(ma_dead_node(mn)))
-		return NULL;
-
-	/* Slot 0 or 1 must be set */
-	if (mas->index > limit)
-		goto none;
-
-	if (likely(entry))
-		return entry;
-
-	mas->offset = 1;
-	entry = mas_slot(mas, slots, 1);
-	pivots = ma_pivots(mn, mt);
-	if (unlikely(ma_dead_node(mn)))
-		return NULL;
-
-	mas->index = pivots[0] + 1;
-	if (mas->index > limit)
-		goto none;
-
-	if (likely(entry))
-		return entry;
-
-none:
-	if (likely(!ma_dead_node(mn)))
-		mas->node = MAS_NONE;
-	return NULL;
-}
-
 /* Depth first search, post-order */
 static void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
 {