return mtree_insert(mt, index, xa_mk_value(index & LONG_MAX), gfp);
}
+static void mtree_erase_index(struct maple_tree *mt, unsigned long index)
+{
+ MT_BUG_ON(mt, mtree_erase(mt, index) != xa_mk_value(index & LONG_MAX));
+ MT_BUG_ON(mt, mtree_load(mt, index) != NULL);
+}
+
static int mtree_test_insert(struct maple_tree *mt, unsigned long index,
void *ptr)
{
void *entry;
MA_STATE(mas, mt, 0, 0);
+ rcu_read_lock();
mas_for_each(&mas, entry, ULONG_MAX)
MT_BUG_ON(mt, true);
+ rcu_read_unlock();
for (i = 0; i < 256; i++) {
mtree_insert_index(mt, i, GFP_KERNEL);
j = 0;
mas_set(&mas, 0);
+ rcu_read_lock();
mas_for_each(&mas, entry, ULONG_MAX) {
MT_BUG_ON(mt, entry != xa_mk_value(j));
j++;
}
+ rcu_read_unlock();
MT_BUG_ON(mt, j != i + 1);
}
- mtree_destroy(mt);
+ for (i = 0; i < 256; i++) {
+ mtree_erase_index(mt, i);
+ }
+
+ MT_BUG_ON(mt, !mtree_empty(mt));
}
#define erase_ptr(i) entry[i%2]