It's just conceivable that `good' is less than `bad_hi' at this point,
which screws everything up. It's essential to pick a consistent upper
bound here.
if (n == want) good = pos;
else bad_hi = pos + n + 1;
}
if (n == want) good = pos;
else bad_hi = pos + n + 1;
}
- recovered(bad_lo, bad_hi); *pos_inout = good;
- if (good < r.pos + r.start || r.pos + r.end <= good)
+ recovered(bad_lo, bad_hi); *pos_inout = bad_hi;
+ if (bad_hi < r.pos + r.start || r.pos + r.end <= bad_hi)
- n = r.pos + r.end - good;
- rearrange_sectors(&r, 0, good - r.pos, n);
+ n = r.pos + r.end - bad_hi;
+ rearrange_sectors(&r, 0, bad_hi - r.pos, n);
}
#ifdef DEBUG
show_recovery_buffer_map(&r, "returning %zd good sectors at %"PRIuSEC"",
}
#ifdef DEBUG
show_recovery_buffer_map(&r, "returning %zd good sectors at %"PRIuSEC"",