copy: remember dirty area

This commit is contained in:
Thomas Schoebel-Theuer 2017-03-01 07:23:36 +01:00
parent 4e8f5d42e1
commit eadd8e3e61
2 changed files with 8 additions and 0 deletions

View File

@ -687,7 +687,10 @@ int _run_copy(struct copy_brick *brick)
this_progress = _next_state(brick, index, pos); this_progress = _next_state(brick, index, pos);
if (this_progress < 0) if (this_progress < 0)
break; break;
progress += this_progress; progress += this_progress;
if (pos > brick->copy_dirty)
brick->copy_dirty = pos;
} }
// check the resulting state: can we advance the copy_last pointer? // check the resulting state: can we advance the copy_last pointer?
@ -798,6 +801,7 @@ static int _copy_thread(void *data)
/* reset the whole area */ /* reset the whole area */
brick->copy_start = 0; brick->copy_start = 0;
brick->copy_last = 0; brick->copy_last = 0;
brick->copy_dirty = 0;
MARS_WRN("resetting the full copy area\n"); MARS_WRN("resetting the full copy area\n");
} }
_update_percent(brick, true); _update_percent(brick, true);
@ -871,6 +875,7 @@ static int copy_switch(struct copy_brick *brick)
brick->is_aborting = false; brick->is_aborting = false;
if (!brick->thread) { if (!brick->thread) {
brick->copy_last = brick->copy_start; brick->copy_last = brick->copy_start;
brick->copy_dirty = 0;
get_lamport(&brick->copy_last_stamp); get_lamport(&brick->copy_last_stamp);
brick->thread = brick_thread_create(_copy_thread, brick, "mars_copy%d", version++); brick->thread = brick_thread_create(_copy_thread, brick, "mars_copy%d", version++);
if (brick->thread) { if (brick->thread) {
@ -908,6 +913,7 @@ char *copy_statistics(struct copy_brick *brick, int verbose)
snprintf(res, 1024, snprintf(res, 1024,
"copy_start = %lld " "copy_start = %lld "
"copy_last = %lld " "copy_last = %lld "
"copy_dirty = %lld "
"copy_end = %lld " "copy_end = %lld "
"copy_error = %d " "copy_error = %d "
"copy_error_count = %d " "copy_error_count = %d "
@ -922,6 +928,7 @@ char *copy_statistics(struct copy_brick *brick, int verbose)
"copy_write_flight = %d\n", "copy_write_flight = %d\n",
brick->copy_start, brick->copy_start,
brick->copy_last, brick->copy_last,
brick->copy_dirty,
brick->copy_end, brick->copy_end,
brick->copy_error, brick->copy_error,
brick->copy_error_count, brick->copy_error_count,

View File

@ -85,6 +85,7 @@ struct copy_brick {
bool abort_mode; // abort on IO error (default is retry forever) bool abort_mode; // abort on IO error (default is retry forever)
// readonly from outside // readonly from outside
loff_t copy_last; // current working position loff_t copy_last; // current working position
loff_t copy_dirty; // end of current working area
struct timespec copy_last_stamp; struct timespec copy_last_stamp;
int copy_error; int copy_error;
int copy_error_count; int copy_error_count;