Skip to content

Commit c5651b3

Browse files
howlettakpm00
authored andcommitted
test_maple_tree: add test for mas_spanning_rebalance() on insufficient data
Add a test to the maple tree test suite for the spanning rebalance insufficient node issue does not go undetected again. Link: https://lkml.kernel.org/r/[email protected] Fixes: 54a611b ("Maple Tree: add new data structure") Signed-off-by: Liam R. Howlett <[email protected]> Cc: Andrei Vagin <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Muhammad Usama Anjum <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0abb964 commit c5651b3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/test_maple_tree.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,25 @@ static noinline void check_dup(struct maple_tree *mt)
24982498
}
24992499
}
25002500

2501+
static noinline void check_bnode_min_spanning(struct maple_tree *mt)
2502+
{
2503+
int i = 50;
2504+
MA_STATE(mas, mt, 0, 0);
2505+
2506+
mt_set_non_kernel(9999);
2507+
mas_lock(&mas);
2508+
do {
2509+
mas_set_range(&mas, i*10, i*10+9);
2510+
mas_store(&mas, check_bnode_min_spanning);
2511+
} while (i--);
2512+
2513+
mas_set_range(&mas, 240, 509);
2514+
mas_store(&mas, NULL);
2515+
mas_unlock(&mas);
2516+
mas_destroy(&mas);
2517+
mt_set_non_kernel(0);
2518+
}
2519+
25012520
static DEFINE_MTREE(tree);
25022521
static int maple_tree_seed(void)
25032522
{
@@ -2742,6 +2761,10 @@ static int maple_tree_seed(void)
27422761
check_dup(&tree);
27432762
mtree_destroy(&tree);
27442763

2764+
mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE);
2765+
check_bnode_min_spanning(&tree);
2766+
mtree_destroy(&tree);
2767+
27452768
#if defined(BENCH)
27462769
skip:
27472770
#endif

0 commit comments

Comments
 (0)