memcpy(d_gaps, s_gaps, size * sizeof(unsigned long));
}
- d_max = s_max;
- if (start + size < mt_pivots[s_mt])
+ /* This is wrong.. */
+ printk("\t\tAssume s_max..\n");
+ printk("\t\tLast src is %u\n", start + size);
+#if 0
+ d_max = 0;
+ if (start + size <= mt_pivots[s_mt])
d_max = s_pivots[size - 1];
- if (d_start + size - 1 < mt_pivots[d_mt])
+ if (d_max > s_max)
+ d_max = s_max;
+#else
+ d_max = s_max;
+ printk("\t\t d_start + size = %u\n", d_start + size);
+ if (start + size < mt_pivots[s_mt]) {
+ if (s_max > s_pivots[size - 1])
+ d_max = s_pivots[size - 1];
+ printk("\t\td_max %lx\n", d_max);
+ }
+#endif
+ if (d_start + size <= mt_pivots[d_mt]) {
+ printk("Set final pivot at %u to %lx\n", size + d_start - 1, d_max);
d_pivots[size - 1] = d_max;
+ }
- printk("cp from %p -> %p %u\n", d_pivots, s_pivots, size);
+// printk("cp from %p -> %p %u\n", d_pivots, s_pivots, size);
fflush(stdout);
- if (size) {
- size--;
+ size--;
+ if (size)
memcpy(d_pivots, s_pivots, size * sizeof(unsigned long));
- }
return d_max;
}
}
printk("%d: size %u\n", __LINE__, size);
- cp->dst[d].max = node_copy(mas, src, s_offset, size,
- s_max, s_mt, dst, dst_offset,
- d_mt);
- printk("%d: set dest max %lx\n", __LINE__, cp->dst[d].max);
+ node_copy(mas, src, s_offset, size, s_max, s_mt, dst,
+ dst_offset, d_mt);
+ //printk("%d: set dest max %lx\n", __LINE__, cp->dst[d].max);
#if 0
{
unsigned long min = cp->min;
if (s_offset > src_end) {
printk("\t\tnext src %u / %u\n", s +1, cp->s_count);
/* This source is exhausted */
+ cp->dst[d].max = s_max;
s++;
if (s >= cp->s_count) {
+ printk("Forced final\n");
node_finalise(dst, d_mt, dst_offset);
return;
}
split = cp->split;
printk("reset split %u\n", split);
/* Handle null entries */
- if (s_max != ULONG_MAX && !ma_slots(dst, d_mt)[dst_offset - 1]) {
+ if (dst_offset <= mt_pivots[d_mt]) {
+ cp->dst[d].max = ma_pivots(dst, d_mt)[dst_offset - 1];
+ printk("%d: set dest max %lx\n", __LINE__, cp->dst[d].max);
+ printk("===================>slot is %p\n", ma_slots(dst,d_mt)[dst_offset - 1]);
+ } else {
+ cp->dst[d].max = s_max;
+ printk("%d: set dest max %lx\n", __LINE__, cp->dst[d].max);
+ }
+ if (cp->dst[d].max != ULONG_MAX &&
+ !ma_slots(dst, d_mt)[dst_offset - 1]) {
printk("NULL entry end %u and max %lx\n", dst_offset - 1, cp->dst[d].max);
//BUG_ON(1);
if (s_offset == cp->src[s].start) {
- src = cp->src[--s].node;
+ s--;
+ src = cp->src[s].node;
src_end = cp->src[s].end;
s_max = cp->src[s].max;
s_mt = cp->src[s].mt;