Skip to contentSkip to conversation

maple_tree: remove mast_overflow.

PATCH NAK Levi Yun 2 participants 2 messages Nov 11, 2023 – Nov 12, 2023

Subsystems (3)
lore
Share & tools
lore

Levi Yun

author
#0 lore raw

PATCH 1/1 maple_tree: remove mast_overflow.

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.

---
 lib/maple_tree.c | 16 ----------------
 1 file changed, 16 deletions(-)
lib/maple_tree.c +0 -16
index bb24d84a4922..1e591e71621e 100644
@@ -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;
Signature · 1 line
2.41.0
#1 lore raw
Quoted 2 lines · Levi Yun

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.

Quoted 49 lines

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.

---
 lib/maple_tree.c | 16 ----------------
 1 file changed, 16 deletions(-)
lib/maple_tree.c +0 -16
index bb24d84a4922..1e591e71621e 100644
@@ -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;
Signature · 1 line
2.41.0