summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Reitz2019-06-12 18:17:06 +0200
committerKevin Wolf2020-09-07 12:31:31 +0200
commitc4db2e25df0e4a91bd8a8044756fe3c712b11768 (patch)
treeb41f9830e675f7f5c4ccca67d499305ee795e886
parentblock: Use CAFs in bdrv_refresh_filename() (diff)
downloadqemu-c4db2e25df0e4a91bd8a8044756fe3c712b11768.tar.gz
qemu-c4db2e25df0e4a91bd8a8044756fe3c712b11768.tar.xz
qemu-c4db2e25df0e4a91bd8a8044756fe3c712b11768.zip
block: Use CAF in bdrv_co_rw_vmstate()
If a node whose driver does not provide VM state functions has a metadata child, the VM state should probably go there; if it is a filter, the VM state should probably go there. It follows that we should generally go down to the primary child. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/io.c b/block/io.c
index 9a1b5c732c..916464f089 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2648,6 +2648,7 @@ bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,
bool is_read)
{
BlockDriver *drv = bs->drv;
+ BlockDriverState *child_bs = bdrv_primary_bs(bs);
int ret = -ENOTSUP;
bdrv_inc_in_flight(bs);
@@ -2660,8 +2661,8 @@ bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,
} else {
ret = drv->bdrv_save_vmstate(bs, qiov, pos);
}
- } else if (bs->file) {
- ret = bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read);
+ } else if (child_bs) {
+ ret = bdrv_co_rw_vmstate(child_bs, qiov, pos, is_read);
}
bdrv_dec_in_flight(bs);