copy: fix error attribution to progress

This commit is contained in:
Thomas Schoebel-Theuer 2017-03-01 07:42:16 +01:00
parent 3a790eadfc
commit 4e8f5d42e1

View File

@ -673,15 +673,21 @@ int _run_copy(struct copy_brick *brick)
for (pos = brick->copy_last; pos < brick->copy_end || brick->append_mode > 1; pos = ((pos / COPY_CHUNK) + 1) * COPY_CHUNK) { for (pos = brick->copy_last; pos < brick->copy_end || brick->append_mode > 1; pos = ((pos / COPY_CHUNK) + 1) * COPY_CHUNK) {
int index = GET_INDEX(pos); int index = GET_INDEX(pos);
struct copy_state *st = &GET_STATE(brick, index); struct copy_state *st = &GET_STATE(brick, index);
int this_progress;
if (max-- <= 0) { if (max-- <= 0) {
break; break;
} }
st->prev = prev; st->prev = prev;
prev = index; prev = index;
if (st->active[0] & st->active[1])
break;
// call the finite state automaton // call the finite state automaton
if (!(st->active[0] | st->active[1])) { this_progress = _next_state(brick, index, pos);
progress += _next_state(brick, index, pos); if (this_progress < 0)
} break;
progress += this_progress;
} }
// check the resulting state: can we advance the copy_last pointer? // check the resulting state: can we advance the copy_last pointer?