maple_tree: remove mast_overflow.

Message ID 20231111110417.38655-1-ppbuk5246@gmail.com
State New
Headers
Series maple_tree: remove mast_overflow. |

Commit Message

Levi Yun Nov. 11, 2023, 11:04 a.m. UTC
  mast_overflow is used only in mas_spanning_rebalance.
But when mast_sufficient is false, mast_overflow always returns false,
and when mast_suffictent is true, it never reaches to mast_overflow in
mas_spanning_rebalance.

Therefore, mast_overflow is dead code in mas_spanning_rebalance.
And there is no other usage of mast_overflow execpt
mas_spanning_rebalance, Remove mast_overflow.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 lib/maple_tree.c | 16 ----------------
 1 file changed, 16 deletions(-)
  

Comments

Liam R. Howlett Nov. 12, 2023, 3:29 p.m. UTC | #1
* Levi Yun <ppbuk5246@gmail.com> [231111 06:04]:
> mast_overflow is used only in mas_spanning_rebalance.
> But when mast_sufficient is false, mast_overflow always returns false,

NACK

mast_sufficient checks the mt_min_slot_count() against the end while
mast_overflow checks the mt_slot_count() against the end.


> and when mast_suffictent is true, it never reaches to mast_overflow in
> mas_spanning_rebalance.
> 
> Therefore, mast_overflow is dead code in mas_spanning_rebalance.
> And there is no other usage of mast_overflow execpt
> mas_spanning_rebalance, Remove mast_overflow.
> 
> Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
> ---
>  lib/maple_tree.c | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index bb24d84a4922..1e591e71621e 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2767,19 +2767,6 @@ static inline bool mast_sufficient(struct maple_subtree_state *mast)
>  	return false;
>  }
>  
> -/*
> - * mast_overflow: Check if there is too much data in the subtree state for a
> - * single node.
> - * @mast: The maple subtree state
> - */
> -static inline bool mast_overflow(struct maple_subtree_state *mast)
> -{
> -	if (mast->bn->b_end >= mt_slot_count(mast->orig_l->node))
> -		return true;
> -
> -	return false;
> -}
> -
>  static inline void *mtree_range_walk(struct ma_state *mas)
>  {
>  	unsigned long *pivots;
> @@ -2934,9 +2921,6 @@ static int mas_spanning_rebalance(struct ma_state *mas,
>  		if (mast_sufficient(mast))
>  			continue;
>  
> -		if (mast_overflow(mast))
> -			continue;
> -
>  		/* May be a new root stored in mast->bn */
>  		if (mas_is_root_limits(mast->orig_l))
>  			break;
> -- 
> 2.41.0
>
  

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index bb24d84a4922..1e591e71621e 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2767,19 +2767,6 @@  static inline bool mast_sufficient(struct maple_subtree_state *mast)
 	return false;
 }
 
-/*
- * mast_overflow: Check if there is too much data in the subtree state for a
- * single node.
- * @mast: The maple subtree state
- */
-static inline bool mast_overflow(struct maple_subtree_state *mast)
-{
-	if (mast->bn->b_end >= mt_slot_count(mast->orig_l->node))
-		return true;
-
-	return false;
-}
-
 static inline void *mtree_range_walk(struct ma_state *mas)
 {
 	unsigned long *pivots;
@@ -2934,9 +2921,6 @@  static int mas_spanning_rebalance(struct ma_state *mas,
 		if (mast_sufficient(mast))
 			continue;
 
-		if (mast_overflow(mast))
-			continue;
-
 		/* May be a new root stored in mast->bn */
 		if (mas_is_root_limits(mast->orig_l))
 			break;