#define erase_check_store_range(mt, a, i, ptr) mtree_test_store_range(mt, a[i],\
a[i + 1], ptr)
-static noinline void check_erase2_testset(struct maple_tree *mt)
-{
#define STORE 1
#define ERASE 2
- unsigned long set[] = {
-STORE, 140737488347136, 140737488351231,
-STORE, 140721266458624, 140737488351231,
-ERASE, 140721266458624, 140737488351231,
-STORE, 140721266458624, 140721266462719,
-STORE, 94735788949504, 94735789121535,
-ERASE, 94735788949504, 94735789121535,
-STORE, 94735788949504, 94735788965887,
-STORE, 94735788965888, 94735789121535,
-ERASE, 94735788965888, 94735789121535,
-STORE, 94735788965888, 94735789068287,
-STORE, 94735789068288, 94735789109247,
-STORE, 94735789109248, 94735789121535,
-STORE, 140253902692352, 140253902864383,
-ERASE, 140253902692352, 140253902864383,
-STORE, 140253902692352, 140253902696447,
-STORE, 140253902696448, 140253902864383,
- };
+static noinline void check_erase2_testset(struct maple_tree *mt,
+ unsigned long *set, unsigned long size)
+{
int entry_cnt = 0;
int check = 0;
void *foo;
unsigned long addr = 0;
mt_dump(mt);
- for (int i = 0; i < ARRAY_SIZE(set); i+=3){
+ for (int i = 0; i < size; i+=3){
switch(set[i]) {
case STORE:
if (!mtree_test_insert_range(mt, set[i + 1],
}
mt_for_each(mt, foo, addr, ULONG_MAX) {
+ printk("addr %lu -> %p\n", addr, foo);
check++;
}
+ printk("test %d != %d\n", check, entry_cnt);
MT_BUG_ON(mt, check != entry_cnt);
}
+
+
+// These tests were pulled from kvm tests.
+static noinline void check_erase2_sets(struct maple_tree *mt)
+{
+ unsigned long start = 0;
+ unsigned long set[] = {
+STORE, 140737488347136, 140737488351231,
+STORE, 140721266458624, 140737488351231,
+ERASE, 140721266458624, 140737488351231,
+STORE, 140721266458624, 140721266462719,
+STORE, 94735788949504, 94735789121535,
+ERASE, 94735788949504, 94735789121535,
+STORE, 94735788949504, 94735788965887,
+STORE, 94735788965888, 94735789121535,
+ERASE, 94735788965888, 94735789121535,
+STORE, 94735788965888, 94735789068287,
+STORE, 94735789068288, 94735789109247,
+STORE, 94735789109248, 94735789121535,
+STORE, 140253902692352, 140253902864383,
+ERASE, 140253902692352, 140253902864383,
+STORE, 140253902692352, 140253902696447,
+STORE, 140253902696448, 140253902864383,
+ };
+ unsigned long set2[] = {
+STORE, 140737488347136, 140737488351232,
+STORE, 140735933583360, 140737488351232,
+ERASE, 140735933583360, 140737488351232,
+STORE, 140735933583360, 140735933587456,
+STORE, 94811003260928, 94811003432960,
+ERASE, 94811003260928, 94811003432960,
+STORE, 94811003260928, 94811003277312,
+STORE, 94811003277312, 94811003432960,
+ERASE, 94811003277312, 94811003432960,
+STORE, 94811003277312, 94811003379712,
+STORE, 94811003379712, 94811003420672,
+STORE, 94811003420672, 94811003432960,
+STORE, 140277094653952, 140277094825984,
+ERASE, 140277094653952, 140277094825984,
+STORE, 140277094653952, 140277094658048,
+STORE, 140277094658048, 140277094825984,
+ERASE, 140277094658048, 140277094825984,
+STORE, 140277094658048, 140277094780928,
+STORE, 140277094780928, 140277094813696,
+STORE, 140277094813696, 140277094821888,
+STORE, 140277094821888, 140277094825984,
+STORE, 140735933906944, 140735933911040,
+ };
+ check_erase2_testset(mt, set, ARRAY_SIZE(set));
+ mtree_destroy(mt);
+ mtree_init(mt, 0);
+ check_erase2_testset(mt, set2, ARRAY_SIZE(set2));
+ start = 140735933894656;
+ printk("mt_find check %lu-%lu\n", start, 140735933906943UL);
+ MT_BUG_ON(mt, mt_find(mt, &start, 140735933906943UL, true));
+
+}
static noinline void check_alloc_rev_range(struct maple_tree *mt)
{
/* Generated by:
check_erase_testset(&tree);
mtree_destroy(&tree);
mtree_init(&tree, 0);
- check_erase2_testset(&tree);
+ check_erase2_sets(&tree);
mtree_destroy(&tree);
mtree_init(&tree, 0);