diff mbox series

[5/7] maple_tree: the type of left subtree is already saved in bnode->type

Message ID 20241127012753.3393-6-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series spanning write related cleanup | expand

Commit Message

Wei Yang Nov. 27, 2024, 1:27 a.m. UTC
mast_sufficient()/mast_overflow() are only used in
mas_spanning_rebalance(). Before doing the check, mast_ascend() has
retrieved the left subtree type and stored in bnode->type.

So we can use the type in bnode->type directly to get minimum slot
count.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 lib/maple_tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 6cabee1371ec..56e9857ce681 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2729,7 +2729,7 @@  static inline void mast_combine_cp_right(struct maple_subtree_state *mast)
  */
 static inline bool mast_sufficient(struct maple_subtree_state *mast)
 {
-	if (mast->bn->b_end > mt_min_slot_count(mast->orig_l->node))
+	if (mast->bn->b_end > mt_min_slots[mast->bn->type])
 		return true;
 
 	return false;
@@ -2742,7 +2742,7 @@  static inline bool mast_sufficient(struct maple_subtree_state *mast)
  */
 static inline bool mast_overflow(struct maple_subtree_state *mast)
 {
-	if (mast->bn->b_end >= mt_slot_count(mast->orig_l->node))
+	if (mast->bn->b_end >= mt_slots[mast->bn->type])
 		return true;
 
 	return false;