}
}
}
-static void spanning_data_write(struct maple_copy *cp, struct ma_state *mas)
+
+static inline
+void spanning_data_write(struct maple_copy *cp, struct ma_state *mas)
{
struct maple_node *dst, *src;
unsigned char s, d;
} while (data_offset <= data);
}
+static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas,
+ struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas)
+{
+ return false; /* for now */
+
+ if (cp->d_count == 1) /* Converged to one node */
+ return false;
+
+}
+
static void mas_spanning_rebalance_loop(struct ma_state *mas,
struct maple_subtree_state *mast, unsigned char count)
{
mt_dump(mas->tree, mt_dump_hex);
- spanning_data_calc(&cp, mas, l_wr_mas, r_wr_mas, &sib);
- spanning_split_dest_setup(&cp, mas, l_wr_mas->type);
- spanning_split_src_setup(&cp, mas, l_wr_mas, r_wr_mas, &sib);
-
-
- spanning_data_write(&cp, mas);
+ do {
+ spanning_data_calc(&cp, mas, l_wr_mas, r_wr_mas, &sib);
+ spanning_split_dest_setup(&cp, mas, l_wr_mas->type);
+ spanning_split_src_setup(&cp, mas, l_wr_mas, r_wr_mas, &sib);
+ spanning_data_write(&cp, mas);
+ } while (spanning_ascend(&cp, mas, l_wr_mas, r_wr_mas));
memset(&b_node, 0, sizeof(struct maple_big_node));
/* Copy l_mas and store the value in b_node. */
if (mast->orig_r->max > mast->orig_r->last) {
mas_mab_cp(mast->orig_r, mast->orig_r->offset,
mast->orig_r->end, &b_node, b_node.b_end + 1);
- printk("big node end %u\n", b_node.b_end);
+ printk("big node end %u\n", b_node.b_end);
} else {
b_node.b_end++;
- printk("big node ++ end %u\n", b_node.b_end);
+ printk("big node ++ end %u\n", b_node.b_end);
}
#endif
mast_spanning_rebalance(mast);
#if 0
- printk("big node end sib %u\n", b_node.b_end);
+ printk("big node end sib %u\n", b_node.b_end);
if (mast->orig_l->node == sib.node)
printk("left\n");
else if (mast->orig_r->node == sib.node)
{
unsigned long min = mas->min;
printk("Count is %u\n", cp.d_count);
- for (int i = 0; i < cp.d_count; i++) {
- printk("dump %p %lu - %lu\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 + 1;
- }
- printk ("VS\n");
+ for (int i = 0; i < cp.d_count; i++) {
+ printk("dump %p %lu - %lu\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 + 1;
+ }
+ printk ("VS\n");
}
#endif
mas_spanning_rebalance_loop(mas, mast, height);