[PATCH 6.6 11/28] maple_tree: use cached node end in mas_destroy()

Yu Kuai posted 28 patches 1 month ago
Only 16 patches received!
[PATCH 6.6 11/28] maple_tree: use cached node end in mas_destroy()
Posted by Yu Kuai 1 month ago
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>

commit 1f41ef12abf8538b3d82cdae14c06aa171cb71ce upstream.

The node end is set during the walk, so use the resulting end instead of
re-fetching it.

Link: https://lkml.kernel.org/r/20231101171629.3612299-7-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 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 e0dcc8412da0..3df7e3456205 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5587,7 +5587,7 @@ void mas_destroy(struct ma_state *mas)
 
 		mas_start(mas);
 		mtree_range_walk(mas);
-		end = mas_data_end(mas) + 1;
+		end = mas->end + 1;
 		if (end < mt_min_slot_count(mas->node) - 1)
 			mas_destroy_rebalance(mas, end);
 
-- 
2.39.2