offset = ma_data_end(node, type, pivots, mas->max);
WARN_ON_ONCE(offset == 0);
- printk("Adopt %p 0 - %u\n", node, offset);
+ //printk("Adopt %p 0 - %u\n", node, offset);
do {
child = mas_slot_locked(mas, slots, offset);
mas_set_parent(mas, child, parent, offset);
if (start + size < mt_pivots[s_mt])
d_max = s_pivots[size - 1];
- size--;
- if (d_start + size < mt_pivots[d_mt])
- d_pivots[size] = d_max;
+ if (d_start + size - 1 < mt_pivots[d_mt])
+ d_pivots[size - 1] = d_max;
- if (size)
+ printk("cp from %p -> %p %u\n", d_pivots, s_pivots, size);
+ fflush(stdout);
+ if (size) {
+ size--;
memcpy(d_pivots, s_pivots, size * sizeof(unsigned long));
+ }
return d_max;
}
struct ma_wr_state *r_wr_mas)
{
unsigned char end = 0;
+
/* Create entries to insert including split entries to left and right */
if (l_wr_mas->r_min < mas->index) {
cp->slot[0] = l_wr_mas->content;
else
cp->gap[end] = mas->last - mas->index + 1;
+ printk("r_wr_mas->r_max %lx mas last %lx offset %u",
+ r_wr_mas->r_max, mas->last, r_wr_mas->mas->offset);
if (r_wr_mas->r_max > mas->last) {
end++;
cp->slot[end] = r_wr_mas->content;
if (cp->data <= mt_slots[mt]) {
cp->split = cp->data;
cp->d_count = 1;
- } else if (cp->data >= mt_slots[mt] * 2 - 1) {
- cp->split = cp->data / 3;
- cp->d_count = 3;
- } else {
+ } else if (cp->data < mt_slots[mt] * 2 - 1) {
cp->split = (cp->data + 1) / 2;
cp->d_count = 2;
+ } else {
+ cp->split = (cp->data + 2) / 3;
+ cp->d_count = 3;
}
for (int i = 0; i < cp->d_count; i++) {
unsigned char split, next_node, size;
unsigned long s_max;
enum maple_type s_mt, d_mt;
+ int debug = 0;
s = d = 0;
/* Readability help */
*/
do {
do {
+ debug++;
+ BUG_ON(debug > 8);
size = next_node - data_offset;
printk("try to use size %d\n", size);
/* Fill the destination */
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);
-#if 1
+#if 0
if (debug < 2)
{
unsigned long min = l_wr_mas->mas->min;
}
if (!r_wr_mas->content) {
- if (r_mas->last < r_wr_mas->r_max)
- r_mas->offset++;
+ //if (r_mas->last < r_wr_mas->r_max)
+ // r_mas->offset++;
r_mas->last = r_wr_mas->r_max;
printk("Extend end pivot\n");
}