From eadd8e3e61ca209aadb1acc0b841f8e9d1033722 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 1 Mar 2017 07:23:36 +0100 Subject: [PATCH] copy: remember dirty area --- kernel/mars_copy.c | 7 +++++++ kernel/mars_copy.h | 1 + 2 files changed, 8 insertions(+) diff --git a/kernel/mars_copy.c b/kernel/mars_copy.c index 93ee2e2a..1d9615fe 100644 --- a/kernel/mars_copy.c +++ b/kernel/mars_copy.c @@ -687,7 +687,10 @@ int _run_copy(struct copy_brick *brick) this_progress = _next_state(brick, index, pos); if (this_progress < 0) break; + progress += this_progress; + if (pos > brick->copy_dirty) + brick->copy_dirty = pos; } // 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 */ brick->copy_start = 0; brick->copy_last = 0; + brick->copy_dirty = 0; MARS_WRN("resetting the full copy area\n"); } _update_percent(brick, true); @@ -871,6 +875,7 @@ static int copy_switch(struct copy_brick *brick) brick->is_aborting = false; if (!brick->thread) { brick->copy_last = brick->copy_start; + brick->copy_dirty = 0; get_lamport(&brick->copy_last_stamp); brick->thread = brick_thread_create(_copy_thread, brick, "mars_copy%d", version++); if (brick->thread) { @@ -908,6 +913,7 @@ char *copy_statistics(struct copy_brick *brick, int verbose) snprintf(res, 1024, "copy_start = %lld " "copy_last = %lld " + "copy_dirty = %lld " "copy_end = %lld " "copy_error = %d " "copy_error_count = %d " @@ -922,6 +928,7 @@ char *copy_statistics(struct copy_brick *brick, int verbose) "copy_write_flight = %d\n", brick->copy_start, brick->copy_last, + brick->copy_dirty, brick->copy_end, brick->copy_error, brick->copy_error_count, diff --git a/kernel/mars_copy.h b/kernel/mars_copy.h index de0cb7e6..75c06856 100644 --- a/kernel/mars_copy.h +++ b/kernel/mars_copy.h @@ -85,6 +85,7 @@ struct copy_brick { bool abort_mode; // abort on IO error (default is retry forever) // readonly from outside loff_t copy_last; // current working position + loff_t copy_dirty; // end of current working area struct timespec copy_last_stamp; int copy_error; int copy_error_count;