struct ma_state *sib)
{
unsigned char d;
- unsigned long min = l_wr_mas->mas->min;
+ unsigned long min;
+
+ printk("%s: %d\n", __func__, cp->d_count);
+
+ if (sib->end) {
+ printk("sib is at %p\n", sib->node);
+ if (sib->max < l_wr_mas->mas->min) {
+ *l_wr_mas->mas = *sib;
+ printk("Shift left\n");
+ } else {
+ *r_wr_mas->mas = *sib;
+ printk("Shift Right: %p\n", r_wr_mas->mas->node);
+ }
+ }
+ min = l_wr_mas->mas->min;
for (d = 0; d < cp->d_count; d++) {
struct maple_node *mn = cp->dst[d].node;
enum maple_type mt = cp->dst[d].mt;
cp->slot[d] = mt_mk_node(mn, mt);
cp->pivot[d] = max;
printk("%p %lx - %lx\n", cp->slot[d], min, max);
- if (ma_is_leaf(mt)) {
- cp->gap[d] = ma_leaf_max_gap(mn, mt, min, max,
- ma_pivots(mn, mt), ma_slots(mn,mt));
- printk("New gap for %p = %lx\n", mn, cp->gap[d]);
- } else {
- unsigned long *gaps = ma_gaps(mn, mt);
+ if (mt_is_alloc(mas->tree)) {
+ if (ma_is_leaf(mt)) {
+ cp->gap[d] = ma_leaf_max_gap(mn, mt, min, max,
+ ma_pivots(mn, mt),
+ ma_slots(mn,mt));
+ } else {
+ unsigned long *gaps = ma_gaps(mn, mt);
- if (gaps) {
- unsigned char gap_slot;
+ if (gaps) {
+ unsigned char gap_slot;
- gap_slot = ma_meta_gap(mn);
- cp->gap[d] = gaps[gap_slot];
+ gap_slot = ma_meta_gap(mn);
+ cp->gap[d] = gaps[gap_slot];
+ }
}
+ printk("gap %lx\n", cp->gap[d]);
}
min = max + 1;
}
- if (sib->end) {
- printk("sib is at %p\n", sib->node);
- if (sib->max < l_wr_mas->mas->min) {
- *l_wr_mas->mas = *sib;
- printk("Shift left\n");
- } else {
- *r_wr_mas->mas = *sib;
- printk("Shift Right: %p\n", r_wr_mas->mas->node);
- }
- }
-
cp->end = cp->d_count - 1;
cp->min = l_wr_mas->mas->min;
cp->max = r_wr_mas->mas->max;
spanning_init_cp_src(cp);
node_copy(mas, cp->src[0].node, 0, cp->data, cp->max, maple_copy,
cp->dst[0].node, 0, mt);
- node_finalise(cp->dst[0].node, mt, cp->end);
+ node_finalise(cp->dst[0].node, mt, cp->end + 1);
cp->slot[0] = mt_mk_node(cp->dst[0].node, mt);
cp->height++;
}
- printk("CONVERGED\n");
+ printk("CONVERGED d_count is %u\n", cp->d_count);
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))
printk("parent %p vs %p\n", cp->dst[0].node->parent, mas_mn(mas)->parent);
printk("cp->dst %p cp->slot %p\n", cp->dst[0].node, mte_to_node(cp->slot[0]));
return false;
- } else if (l_wr_mas->mas->node == r_wr_mas->mas->node){
+ } else if (l_wr_mas->mas->node == r_wr_mas->mas->node) {
+ /* Converged, but caused a cascading split. */
WARN_ON_ONCE(cp->d_count != 1);
- cp->dst[0].node->parent = mas_mn(mas)->parent;
- return false;
+ printk("WARNING! CONVERGED d_count is %u\n", cp->d_count);
+ //cp->dst[0].node->parent = mas_mn(mas)->parent;
+ //return false;
}
printk("more nodes.. %u\n", cp->end);