aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2013-08-23 09:14:51 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:08 +0200
commitfa510ebffa1fd509323e2e0888e369e23adbb508 (patch)
tree62bb139b70cfe5d10f692e0c96104cf910e0221c /blockjob.c
parent38b54b6dc18ae7e2a32e5ae38b312fb13f0584c8 (diff)
downloadqemu-fa510ebffa1fd509323e2e0888e369e23adbb508.zip
qemu-fa510ebffa1fd509323e2e0888e369e23adbb508.tar.gz
qemu-fa510ebffa1fd509323e2e0888e369e23adbb508.tar.bz2
block: use BDS ref for block jobs
Block jobs used drive_get_ref(drive_get_by_blockdev(bs)) to avoid BDS being deleted. Now we have BDS reference count, and block jobs don't care about dinfo, so replace them to get cleaner code. It is also the safe way when BDS has no drive info. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/blockjob.c b/blockjob.c
index 7edc945..e7d49b7 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -45,6 +45,7 @@ void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
return NULL;
}
+ bdrv_ref(bs);
bdrv_set_in_use(bs, 1);
job = g_malloc0(job_type->instance_size);