aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/blockjob.c b/blockjob.c
index da11b3b763..5c8ff6f846 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -242,16 +242,6 @@ int64_t block_job_ratelimit_get_delay(BlockJob *job, uint64_t n)
return ratelimit_calculate_delay(&job->limit, n);
}
-void block_job_progress_update(BlockJob *job, uint64_t done)
-{
- job->offset += done;
-}
-
-void block_job_progress_set_remaining(BlockJob *job, uint64_t remaining)
-{
- job->len = job->offset + remaining;
-}
-
BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
{
BlockJobInfo *info;
@@ -263,10 +253,10 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
info = g_new0(BlockJobInfo, 1);
info->type = g_strdup(job_type_str(&job->job));
info->device = g_strdup(job->job.id);
- info->len = job->len;
info->busy = atomic_read(&job->job.busy);
info->paused = job->job.pause_count > 0;
- info->offset = job->offset;
+ info->offset = job->job.progress_current;
+ info->len = job->job.progress_total;
info->speed = job->speed;
info->io_status = job->iostatus;
info->ready = job_is_ready(&job->job),
@@ -296,8 +286,8 @@ static void block_job_event_cancelled(Notifier *n, void *opaque)
qapi_event_send_block_job_cancelled(job_type(&job->job),
job->job.id,
- job->len,
- job->offset,
+ job->job.progress_total,
+ job->job.progress_current,
job->speed,
&error_abort);
}
@@ -317,8 +307,8 @@ static void block_job_event_completed(Notifier *n, void *opaque)
qapi_event_send_block_job_completed(job_type(&job->job),
job->job.id,
- job->len,
- job->offset,
+ job->job.progress_total,
+ job->job.progress_current,
job->speed,
!!msg,
msg,
@@ -348,8 +338,8 @@ static void block_job_event_ready(Notifier *n, void *opaque)
qapi_event_send_block_job_ready(job_type(&job->job),
job->job.id,
- job->len,
- job->offset,
+ job->job.progress_total,
+ job->job.progress_current,
job->speed, &error_abort);
}