maple_tree: add some alloc node test case

Add some maple_tree alloc node tese case.

Link: https://lkml.kernel.org/r/20240626160631.3636515-2-Liam.Howlett@oracle.com
Signed-off-by: Jiazi Li <jqqlijiazi@gmail.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Suggested-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Jiazi Li 2024-06-26 12:06:31 -04:00 committed by Andrew Morton
parent 5b2100f723
commit 0f85eb3395

View File

@ -462,6 +462,28 @@ static noinline void __init check_new_node(struct maple_tree *mt)
MT_BUG_ON(mt, mas_allocated(&mas) != 10 + MAPLE_ALLOC_SLOTS - 1);
mas_destroy(&mas);
mas.node = MA_ERROR(-ENOMEM);
mas_node_count(&mas, MAPLE_ALLOC_SLOTS + 1); /* Request */
mas_nomem(&mas, GFP_KERNEL); /* Fill request */
MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_ALLOC_SLOTS + 1);
mas.node = MA_ERROR(-ENOMEM);
mas_node_count(&mas, MAPLE_ALLOC_SLOTS * 2 + 2); /* Request */
mas_nomem(&mas, GFP_KERNEL); /* Fill request */
mas.status = ma_start;
MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_ALLOC_SLOTS * 2 + 2);
mas_destroy(&mas);
mas.node = MA_ERROR(-ENOMEM);
mas_node_count(&mas, MAPLE_ALLOC_SLOTS * 2 + 1); /* Request */
mas_nomem(&mas, GFP_KERNEL); /* Fill request */
MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_ALLOC_SLOTS * 2 + 1);
mas.node = MA_ERROR(-ENOMEM);
mas_node_count(&mas, MAPLE_ALLOC_SLOTS * 3 + 2); /* Request */
mas_nomem(&mas, GFP_KERNEL); /* Fill request */
mas.status = ma_start;
MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_ALLOC_SLOTS * 3 + 2);
mas_destroy(&mas);
mtree_unlock(mt);
}