summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2016-03-16 19:54:39 +0100
committerKevin Wolf <kwolf@redhat.com>2016-03-17 15:47:56 +0100
commit7c735873d93ac18a6f06850c7ca6b3722b1b32c5 (patch)
treefe8f1e96fe9172db71e68d5cba2c3570a64d4ac7 /blockdev.c
parentefaa7c4eeb7490c6f37f34fbc77e91f29363eebd (diff)
downloadqemu-7c735873d93ac18a6f06850c7ca6b3722b1b32c5.zip
blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()
We can basically inline it in hmp_drive_del(); monitor_remove_blk() is called already, so we just need to call bdrv_make_anon(), too. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/blockdev.c b/blockdev.c
index d0e3d9c41a..b6d24449e3 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2865,15 +2865,16 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
blk_remove_bs(blk);
}
+ /* Make the BlockBackend and the attached BlockDriverState anonymous */
monitor_remove_blk(blk);
+ if (blk_bs(blk)) {
+ bdrv_make_anon(blk_bs(blk));
+ }
- /* if we have a device attached to this BlockDriverState
- * then we need to make the drive anonymous until the device
- * can be removed. If this is a drive with no device backing
- * then we can just get rid of the block driver state right here.
+ /* If this BlockBackend has a device attached to it, its refcount will be
+ * decremented when the device is removed; otherwise we have to do so here.
*/
if (blk_get_attached_dev(blk)) {
- blk_hide_on_behalf_of_hmp_drive_del(blk);
/* Further I/O must not pause the guest */
blk_set_on_error(blk, BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT);