[PATCH v5 5/5] maple_tree: add a test checking storing null
Andrew Morton
akpm at linux-foundation.org
Thu Oct 31 20:37:57 PDT 2024
On Thu, 31 Oct 2024 23:16:27 +0000 Wei Yang <richard.weiyang at gmail.com> wrote:
> Add a test to assert that, when storing null to am empty tree or a
> single entry tree it will not result into:
>
> * a root node with range [0, ULONG_MAX] set to NULL
> * a root node with consecutive slot set to NULL
>
I don't get it.
> --- a/lib/test_maple_tree.c
> +++ b/lib/test_maple_tree.c
> @@ -1387,6 +1387,92 @@ static noinline void __init check_prev_entry(struct maple_tree *mt)
> mas_unlock(&mas);
> }
>
> +static noinline void __init check_store_null(struct maple_tree *mt)
> +{
> + MA_STATE(mas, mt, 0, ULONG_MAX);
> +
>
> ...
>
> + MT_BUG_ON(mt, !xa_is_node(mas_root(&mas)));
> ...
>
mas_root() is private to lib/maple_tree.c. I'll do this for now:
--- a/lib/test_maple_tree.c~maple_tree-add-a-test-checking-storing-null-fix
+++ a/lib/test_maple_tree.c
@@ -1453,7 +1453,7 @@ static noinline void __init check_store_
mas_set_range(&mas, 2, 5);
mas_store_gfp(&mas, NULL, GFP_KERNEL);
MT_BUG_ON(mt, mtree_empty(mt));
- MT_BUG_ON(mt, xa_is_node(mas_root(&mas)));
+// MT_BUG_ON(mt, xa_is_node(mas_root(&mas)));
mas_unlock(&mas);
mtree_destroy(mt);
@@ -1465,7 +1465,7 @@ static noinline void __init check_store_
mas_lock(&mas);
mas_set_range(&mas, 1, 3);
mas_store_gfp(&mas, &mas, GFP_KERNEL);
- MT_BUG_ON(mt, !xa_is_node(mas_root(&mas)));
+// MT_BUG_ON(mt, !xa_is_node(mas_root(&mas)));
mas_set_range(&mas, 0, ULONG_MAX);
mas_store_gfp(&mas, NULL, GFP_KERNEL);
MT_BUG_ON(mt, !mtree_empty(mt));
_
More information about the maple-tree
mailing list