block: make .bdrv_close optional
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8d65a3ccfd
commit
3c005293c2
2
block.c
2
block.c
@ -3349,7 +3349,9 @@ static void bdrv_close(BlockDriverState *bs)
|
||||
bdrv_drain(bs); /* in case flush left pending I/O */
|
||||
|
||||
if (bs->drv) {
|
||||
if (bs->drv->bdrv_close) {
|
||||
bs->drv->bdrv_close(bs);
|
||||
}
|
||||
bs->drv = NULL;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,9 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
||||
qobject_unref(file_options);
|
||||
qdict_put_str(options, "file", bdrv_get_node_name(file));
|
||||
|
||||
if (drv->bdrv_close) {
|
||||
drv->bdrv_close(bs);
|
||||
}
|
||||
bdrv_unref_child(bs, bs->file);
|
||||
bs->file = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user