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>
This commit is contained in:
parent
efaa7c4eeb
commit
7c735873d9
|
@ -385,23 +385,6 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Hide @blk.
|
|
||||||
* @blk must not have been hidden already.
|
|
||||||
* Make attached BlockDriverState, if any, anonymous.
|
|
||||||
* Once hidden, @blk is invisible to all functions that don't receive
|
|
||||||
* it as argument. For example, blk_by_name() won't return it.
|
|
||||||
* Strictly for use by do_drive_del().
|
|
||||||
* TODO get rid of it!
|
|
||||||
*/
|
|
||||||
void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk)
|
|
||||||
{
|
|
||||||
monitor_remove_blk(blk);
|
|
||||||
if (blk->bs) {
|
|
||||||
bdrv_make_anon(blk->bs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disassociates the currently associated BlockDriverState from @blk.
|
* Disassociates the currently associated BlockDriverState from @blk.
|
||||||
*/
|
*/
|
||||||
|
|
11
blockdev.c
11
blockdev.c
|
@ -2865,15 +2865,16 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
|
||||||
blk_remove_bs(blk);
|
blk_remove_bs(blk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make the BlockBackend and the attached BlockDriverState anonymous */
|
||||||
monitor_remove_blk(blk);
|
monitor_remove_blk(blk);
|
||||||
|
if (blk_bs(blk)) {
|
||||||
|
bdrv_make_anon(blk_bs(blk));
|
||||||
|
}
|
||||||
|
|
||||||
/* if we have a device attached to this BlockDriverState
|
/* If this BlockBackend has a device attached to it, its refcount will be
|
||||||
* then we need to make the drive anonymous until the device
|
* decremented when the device is removed; otherwise we have to do so here.
|
||||||
* 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 (blk_get_attached_dev(blk)) {
|
if (blk_get_attached_dev(blk)) {
|
||||||
blk_hide_on_behalf_of_hmp_drive_del(blk);
|
|
||||||
/* Further I/O must not pause the guest */
|
/* Further I/O must not pause the guest */
|
||||||
blk_set_on_error(blk, BLOCKDEV_ON_ERROR_REPORT,
|
blk_set_on_error(blk, BLOCKDEV_ON_ERROR_REPORT,
|
||||||
BLOCKDEV_ON_ERROR_REPORT);
|
BLOCKDEV_ON_ERROR_REPORT);
|
||||||
|
|
|
@ -77,8 +77,6 @@ BlockDriverState *blk_bs(BlockBackend *blk);
|
||||||
void blk_remove_bs(BlockBackend *blk);
|
void blk_remove_bs(BlockBackend *blk);
|
||||||
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs);
|
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs);
|
||||||
|
|
||||||
void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk);
|
|
||||||
|
|
||||||
void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow);
|
void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow);
|
||||||
void blk_iostatus_enable(BlockBackend *blk);
|
void blk_iostatus_enable(BlockBackend *blk);
|
||||||
bool blk_iostatus_is_enabled(const BlockBackend *blk);
|
bool blk_iostatus_is_enabled(const BlockBackend *blk);
|
||||||
|
|
Loading…
Reference in New Issue