aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:08 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 13:41:26 +0200
commit9ba10c95a4a63ef453893ba16bf1c8e11a1d3c39 (patch)
treeeffe1e5953818f0965be290de0748b5516e7015a /qemu-io.c
parent8fb3c76c949f34f29c5252ee339fbe1cbfcc3234 (diff)
block: Make BlockBackend own its BlockDriverState
On BlockBackend destruction, unref its BlockDriverState. Replaces the callers' unrefs. This turns the pointer from BlockBackend to BlockDriverState into a strong reference, managed with bdrv_ref() / bdrv_unref(). The back-pointer remains weak. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 8380734b08..60f84dd72a 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -38,7 +38,6 @@ static ReadLineState *readline_state;
static int close_f(BlockDriverState *bs, int argc, char **argv)
{
- bdrv_unref(bs);
blk_unref(qemuio_blk);
qemuio_bs = NULL;
qemuio_blk = NULL;
@@ -74,7 +73,6 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
- bdrv_unref(qemuio_bs);
blk_unref(qemuio_blk);
qemuio_bs = NULL;
qemuio_blk = NULL;
@@ -488,9 +486,6 @@ int main(int argc, char **argv)
*/
bdrv_drain_all();
- if (qemuio_bs) {
- bdrv_unref(qemuio_bs);
- }
blk_unref(qemuio_blk);
g_free(readline_state);
return 0;