MT_BUG_ON(mt, mas_allocated(&mas2) != 0);
}
+
+ MT_BUG_ON(mt, mas_allocated(&mas) != 0);
+ mas_node_count(&mas, MAPLE_NODE_SLOTS); // Request
+ MT_BUG_ON(mt, mas.node != MA_ERROR(-ENOMEM));
+ MT_BUG_ON(mt, !mas_nomem(&mas, GFP_KERNEL));
+ printk("alloc node total %u\n", mas.alloc->total);
+ MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_NODE_SLOTS);
+ printk("alloc node count %u\n", mas.alloc->node_count);
+ MT_BUG_ON(mt, mas.alloc->node_count != MAPLE_NODE_SLOTS - 2);
+
+ mn = mas_pop_node(&mas); // get the next node.
+ printk("alloc node count %u\n", mas.alloc->node_count);
+ MT_BUG_ON(mt, mn == NULL);
+ MT_BUG_ON(mt, mas.alloc->node_count != MAPLE_NODE_SLOTS - 3);
+ MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_NODE_SLOTS - 1);
+
+ mas_push_node(&mas, (struct maple_enode *)mn);
+ printk("alloc node count %u\n", mas.alloc->node_count);
+ MT_BUG_ON(mt, mas.alloc->node_count != MAPLE_NODE_SLOTS - 2);
+ MT_BUG_ON(mt, mas_allocated(&mas) != MAPLE_NODE_SLOTS);
+
+ printk("Add one on the end\n");
+ printk("alloc node count %u\n", mas.alloc->node_count);
+ printk("alloc node total %u\n", mas.alloc->total);
+ printk("Request %u\n", MAPLE_NODE_SLOTS + 1);
+ mas_node_count(&mas, MAPLE_NODE_SLOTS + 1); // Request
+ printk("alloc req %u\n", mas_alloc_req(&mas));
+ MT_BUG_ON(mt, mas_alloc_req(&mas) != 1);
+ MT_BUG_ON(mt, mas.node != MA_ERROR(-ENOMEM));
+ MT_BUG_ON(mt, !mas_nomem(&mas, GFP_KERNEL));
+ MT_BUG_ON(mt, mas_alloc_req(&mas));
+ printk("alloc node count %u\n", mas.alloc->node_count);
+ printk("alloc node total %u\n", mas.alloc->total);
+ mn = mas_pop_node(&mas);
+ ma_free_rcu(mn);
+ for (i = 1; i <= MAPLE_NODE_SLOTS; i++) {
+ mn = mas_pop_node(&mas);
+ ma_free_rcu(mn);
+ }
+ MT_BUG_ON(mt, mas_allocated(&mas) != 0);
mtree_unlock(mt);
mtree_destroy(mt);
}