mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
blockjob: Introduce reference count and fix reference to job->bs
Add reference count to block job, meanwhile move the ownership of the reference to job->bs from the caller (which is released in two completion callbacks) to the block job itself. It is necessary for block_job_complete_sync to work, because block job shouldn't live longer than its bs, as asserted in bdrv_delete. Now block_job_complete_sync can be simplified. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1446765200-3054-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
b976ea3cf5
commit
18930ba3d1
5 changed files with 32 additions and 44 deletions
|
@ -645,9 +645,6 @@ static void common_block_job_cb(void *opaque, int ret)
|
|||
if (ret < 0) {
|
||||
error_setg_errno(cbi->errp, -ret, "Block job failed");
|
||||
}
|
||||
|
||||
/* Drop this block job's reference */
|
||||
bdrv_unref(cbi->bs);
|
||||
}
|
||||
|
||||
static void run_block_job(BlockJob *job, Error **errp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue