On 06/10/2016 10:05 AM, Kevin Wolf wrote: > This brings it in line with .bdrv_save_vmstate(). > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > block/io.c | 26 +++++++++++++++++++++----- > block/qcow2.c | 6 +++--- > block/sheepdog.c | 13 ++++++++++--- > include/block/block.h | 1 + > include/block/block_int.h | 4 ++-- > 5 files changed, 37 insertions(+), 13 deletions(-) > > diff --git a/block/io.c b/block/io.c > index 11510cf..602c7d3 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -1862,13 +1862,29 @@ int bdrv_writev_vmstate(BlockDriverState *bs, > QEMUIOVector *qiov, int64_t pos) > int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf, > int64_t pos, int size) > { > + QEMUIOVector qiov; > + struct iovec iov = { > + .iov_base = buf, > + .iov_len = size, > + }; > + int ret;
Dead variable. > + > + qemu_iovec_init_external(&qiov, &iov, 1); > + return bdrv_readv_vmstate(bs, &qiov, pos); > +} > + > +int bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos) > +{ > BlockDriver *drv = bs->drv; > - if (!drv) > + > + if (!drv) { > return -ENOMEDIUM; > - if (drv->bdrv_load_vmstate) > - return drv->bdrv_load_vmstate(bs, buf, pos, size); > - if (bs->file) > - return bdrv_load_vmstate(bs->file->bs, buf, pos, size); > + } else if (drv->bdrv_load_vmstate) { > + return drv->bdrv_load_vmstate(bs, qiov, pos); > + } else if (bs->file) { > + return bdrv_readv_vmstate(bs->file->bs, qiov, pos); > + } Don't know that I would have used 'else if' after a return, but it's not wrong, so no need to change. With the dead 'ret' gone, Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature