mirror of https://gitlab.com/qemu-project/qemu
block: Make device model's references to BlockBackend strong
Doesn't make a difference just yet, but it's the right thing to do. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a7f53e26a6
commit
84ebe3755f
|
@ -257,6 +257,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev)
|
||||||
if (blk->dev) {
|
if (blk->dev) {
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
blk_ref(blk);
|
||||||
blk->dev = dev;
|
blk->dev = dev;
|
||||||
bdrv_iostatus_reset(blk->bs);
|
bdrv_iostatus_reset(blk->bs);
|
||||||
|
|
||||||
|
@ -290,6 +291,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev)
|
||||||
blk->dev_opaque = NULL;
|
blk->dev_opaque = NULL;
|
||||||
bdrv_set_guest_block_size(blk->bs, 512);
|
bdrv_set_guest_block_size(blk->bs, 512);
|
||||||
qemu_coroutine_adjust_pool_size(-COROUTINE_POOL_RESERVATION);
|
qemu_coroutine_adjust_pool_size(-COROUTINE_POOL_RESERVATION);
|
||||||
|
blk_unref(blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue