void __rcu **slots;
if (mte_is_root(mas->node)) {
+ printk("new root in tree\n");
mas_mn(mas)->parent = ma_parent_ptr(mas_tree_parent(mas));
rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
mt_set_height(mas->tree, new_height);
} else {
+ printk("Replace node in tree\n");
offset = mte_parent_slot(mas->node);
slots = ma_slots(mte_parent(mas->node),
mas_parent_type(mas, mas->node));
}
printk("CONVERGED\n");
+ WARN_ON_ONCE(cp->dst[0].node != mte_to_node(cp->slot[0]));
cp->dst[0].node->parent = ma_parent_ptr(mas_tree_parent(mas));
while (!mte_is_root(mas->node))
mas_ascend(mas);
static void mas_wr_spanning_rebalance(struct ma_state *mas,
- unsigned char height, struct ma_wr_state *l_wr_mas,
- struct ma_wr_state *r_wr_mas)
+ struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas)
{
struct maple_enode *old_enode;
struct ma_state sib;
struct maple_copy cp;
int debug = 0;
+ unsigned char count = 1;
/*
* Spanning store is different in that the write is actually from
spanning_leaf_init(&cp, mas, l_wr_mas, r_wr_mas);
do {
printk("\nlmas %p rmas %p\n", l_wr_mas->node, r_wr_mas->node);
+ count++;
spanning_data_calc(&cp, mas, l_wr_mas, r_wr_mas, &sib);
spanning_split_dest_setup(&cp, mas, l_wr_mas->type);
for (int i = 0; i < cp.d_count; i++) {
printk("dump %p %lx - %lx\n", cp.dst[i].node, min, cp.dst[i].max);
mt_dump_node(mas->tree, mt_mk_node(cp.dst[i].node, cp.dst[i].mt),
- min, cp.dst[i].max, height, mt_dump_hex);
+ min, cp.dst[i].max, count, mt_dump_hex);
min = cp.dst[i].max + 1;
}
}
old_enode = mas->node;
mas->node = cp.slot[0];
printk("Replace %p with %p\n", old_enode, mas->node);
- mas_wmb_replace(mas, old_enode, height);
+ mas_wmb_replace(mas, old_enode, count);
mtree_range_walk(mas);
+ printk("range at %p[%u]\n", mas->node, mas->offset);
+ mt_dump(mas->tree, mt_dump_hex);
}
/*
static void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
{
struct ma_state *mas;
- unsigned char height;
/* Left and Right side of spanning store */
MA_STATE(r_mas, NULL, 0, 0);
* Node rebalancing may occur due to this store, so there may be three new
* entries per level plus a new root.
*/
- height = mas_mt_height(mas);
/*
* Set up right side. Need to get to the next offset after the spanning
return mas_new_root(mas, wr_mas->entry);
}
- mas_wr_spanning_rebalance(mas, height + 1, wr_mas, &r_wr_mas);
+ mas_wr_spanning_rebalance(mas, wr_mas, &r_wr_mas);
}
/*