diff mbox series

[v2,1/2] maple_tree: calculate new_end when needed

Message ID 20241017015809.23392-2-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series Following cleanup after introduce mas_wr_store_type() | expand

Commit Message

Wei Yang Oct. 17, 2024, 1:58 a.m. UTC
For wr_exact_fit/wr_new_root, we don't need to calculate new_end.

Let's postpone it until necessary.

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>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 511afb8ad1dc..b26f8df09588 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4117,7 +4117,6 @@  static inline void mas_wr_store_type(struct ma_wr_state *wr_mas)
 	if (!wr_mas->entry)
 		mas_wr_extend_null(wr_mas);
 
-	new_end = mas_wr_new_end(wr_mas);
 	if ((wr_mas->r_min == mas->index) && (wr_mas->r_max == mas->last)) {
 		mas->store_type = wr_exact_fit;
 		return;
@@ -4128,6 +4127,7 @@  static inline void mas_wr_store_type(struct ma_wr_state *wr_mas)
 		return;
 	}
 
+	new_end = mas_wr_new_end(wr_mas);
 	/* Potential spanning rebalance collapsing a node */
 	if (new_end < mt_min_slots[wr_mas->type]) {
 		if (!mte_is_root(mas->node)) {