mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
job: Move progress fields to Job
BlockJob has fields .offset and .len, which are actually misnomers today because they are no longer tied to block device sizes, but just progress counters. As such they make a lot of sense in generic Jobs. This patch moves the fields to Job and renames them to .progress_current and .progress_total to describe their function better. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
2e1795b581
commit
30a5c887bf
9 changed files with 62 additions and 55 deletions
|
@ -160,7 +160,7 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job,
|
|||
* offset field is an opaque progress value, it is not a disk offset.
|
||||
*/
|
||||
job->bytes_read += n;
|
||||
block_job_progress_update(&job->common, n);
|
||||
job_progress_update(&job->common.job, n);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -406,8 +406,8 @@ static void backup_incremental_init_copy_bitmap(BackupBlockJob *job)
|
|||
bdrv_set_dirty_iter(dbi, next_cluster * job->cluster_size);
|
||||
}
|
||||
|
||||
/* TODO block_job_progress_set_remaining() would make more sense */
|
||||
block_job_progress_update(&job->common,
|
||||
/* TODO job_progress_set_remaining() would make more sense */
|
||||
job_progress_update(&job->common.job,
|
||||
job->len - hbitmap_count(job->copy_bitmap) * job->cluster_size);
|
||||
|
||||
bdrv_dirty_iter_free(dbi);
|
||||
|
@ -425,7 +425,7 @@ static void coroutine_fn backup_run(void *opaque)
|
|||
qemu_co_rwlock_init(&job->flush_rwlock);
|
||||
|
||||
nb_clusters = DIV_ROUND_UP(job->len, job->cluster_size);
|
||||
block_job_progress_set_remaining(&job->common, job->len);
|
||||
job_progress_set_remaining(&job->common.job, job->len);
|
||||
|
||||
job->copy_bitmap = hbitmap_alloc(nb_clusters, 0);
|
||||
if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue