maple_tree: use cached node end in mas_destroy()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 1 Nov 2023 17:16:23 +0000 (13:16 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 12 Dec 2023 18:56:58 +0000 (10:56 -0800)
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>
lib/maple_tree.c

index 1e617be77dfbeda828a4c10f6529836cc77524a5..216f541771517d2f02323def13738d5344247324 100644 (file)
@@ -5576,7 +5576,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);