maple_tree: move debug check to __mas_set_range()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 1 Nov 2023 17:16:20 +0000 (13:16 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 12 Dec 2023 18:56:57 +0000 (10:56 -0800)
commitbf857ddd21d0bffc1edafc317e8e2ce0d6d5950c
treea67bbdd3c05f8e2da3f1001f3b7df2fdb235fc0b
parentf7a59018953910032231c0a019208c4b0a4a8bc3
maple_tree: move debug check to __mas_set_range()

__mas_set_range() was created to shortcut resetting the maple state and a
debug check was added to the caller (the vma iterator) to ensure the
internal maple state remains safe to use.  Move the debug check from the
vma iterator into the maple tree itself so other users do not incorrectly
use the advanced maple state modification.

Fallout from this change include a large amount of debug setup needed to
be moved to earlier in the header, and the maple_tree.h radix-tree test
code needed to move the inclusion of the header to after the atomic
define.  None of those changes have functional changes.

Link: https://lkml.kernel.org/r/20231101171629.3612299-4-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>
include/linux/maple_tree.h
mm/internal.h
tools/testing/radix-tree/linux/maple_tree.h