Skip to content

Commit 8e50d32

Browse files
Peng Zhangakpm00
authored andcommitted
maple_tree: preserve the tree attributes when destroying maple tree
When destroying maple tree, preserve its attributes and then turn it into an empty tree. This allows it to be reused without needing to be reinitialized. Link: https://lkml.kernel.org/r/20231027033845.90608-10-zhangpeng.00@bytedance.com Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Mateusz Guzik <mjguzik@gmail.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Mike Christie <michael.christie@oracle.com> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 446e186 commit 8e50d32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/maple_tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6763,7 +6763,7 @@ void __mt_destroy(struct maple_tree *mt)
67636763
if (xa_is_node(root))
67646764
mte_destroy_walk(root, mt);
67656765

6766-
mt->ma_flags = 0;
6766+
mt->ma_flags = mt_attr(mt);
67676767
}
67686768
EXPORT_SYMBOL_GPL(__mt_destroy);
67696769

0 commit comments

Comments
 (0)