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@xxxxxxxxx> CC: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> CC: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx> CC: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx> --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 61de8f1daee8..f2628e3f3efc 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4122,7 +4122,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; @@ -4133,6 +4132,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)) { -- 2.34.1