diff options
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/qemu-img.c b/qemu-img.c index a5993682aa..7956a89965 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -900,6 +900,7 @@ static void common_block_job_cb(void *opaque, int ret) static void run_block_job(BlockJob *job, Error **errp) { + uint64_t progress_current, progress_total; AioContext *aio_context = blk_get_aio_context(job->blk); int ret = 0; @@ -908,9 +909,11 @@ static void run_block_job(BlockJob *job, Error **errp) do { float progress = 0.0f; aio_poll(aio_context, true); - if (job->job.progress.total) { - progress = (float)job->job.progress.current / - job->job.progress.total * 100.f; + + progress_get_snapshot(&job->job.progress, &progress_current, + &progress_total); + if (progress_total) { + progress = (float)progress_current / progress_total * 100.f; } qemu_progress_print(progress, 0); } while (!job_is_ready(&job->job) && !job_is_completed(&job->job)); |