aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/block/commit.c b/block/commit.c
index 1432baeef4..50b191c980 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -146,21 +146,21 @@ static void coroutine_fn commit_run(void *opaque)
int64_t n = 0; /* bytes */
void *buf = NULL;
int bytes_written = 0;
- int64_t base_len;
+ int64_t len, base_len;
- ret = s->common.len = blk_getlength(s->top);
-
- if (s->common.len < 0) {
+ ret = len = blk_getlength(s->top);
+ if (len < 0) {
goto out;
}
+ block_job_progress_set_remaining(&s->common, len);
ret = base_len = blk_getlength(s->base);
if (base_len < 0) {
goto out;
}
- if (base_len < s->common.len) {
- ret = blk_truncate(s->base, s->common.len, PREALLOC_MODE_OFF, NULL);
+ if (base_len < len) {
+ ret = blk_truncate(s->base, len, PREALLOC_MODE_OFF, NULL);
if (ret) {
goto out;
}
@@ -168,7 +168,7 @@ static void coroutine_fn commit_run(void *opaque)
buf = blk_blockalign(s->top, COMMIT_BUFFER_SIZE);
- for (offset = 0; offset < s->common.len; offset += n) {
+ for (offset = 0; offset < len; offset += n) {
bool copy;
/* Note that even when no rate limit is applied we need to yield
@@ -198,7 +198,7 @@ static void coroutine_fn commit_run(void *opaque)
}
}
/* Publish progress */
- s->common.offset += n;
+ block_job_progress_update(&s->common, n);
if (copy && s->common.speed) {
delay_ns = ratelimit_calculate_delay(&s->limit, n);