mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
job: Add reference counting
This moves reference counting from BlockJob to Job. In order to keep calling the BlockJob cleanup code when the job is deleted via job_unref(), introduce a new JobDriver.free callback. Every block job must use block_job_free() for this callback, this is asserted in block_job_create(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
a50c2ab858
commit
80fa2c756b
13 changed files with 77 additions and 59 deletions
|
@ -861,7 +861,7 @@ static void run_block_job(BlockJob *job, Error **errp)
|
|||
int ret = 0;
|
||||
|
||||
aio_context_acquire(aio_context);
|
||||
block_job_ref(job);
|
||||
job_ref(&job->job);
|
||||
do {
|
||||
aio_poll(aio_context, true);
|
||||
qemu_progress_print(job->len ?
|
||||
|
@ -873,7 +873,7 @@ static void run_block_job(BlockJob *job, Error **errp)
|
|||
} else {
|
||||
ret = job->ret;
|
||||
}
|
||||
block_job_unref(job);
|
||||
job_unref(&job->job);
|
||||
aio_context_release(aio_context);
|
||||
|
||||
/* publish completion progress only when success */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue