On 04/27/2016 03:52 AM, Kevin Wolf wrote:
> This is a function that simply calls into the block driver for doing a
> read, providing the byte granularity interface we want to eventually
> have everywhere, and using whatever interface that driver supports.
> 
> For now, this is just a wrapper for calling bs->drv->bdrv_co_readv().
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  block/io.c | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/block/io.c b/block/io.c
> index a7dbf85..586a46a 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -800,6 +800,21 @@ int bdrv_pwrite_sync(BlockDriverState *bs, int64_t 
> offset,
>      return 0;
>  }
>  
> +static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs,
> +                                           uint64_t offset, uint64_t bytes,
> +                                           QEMUIOVector *qiov, int flags)
> +{
> +    BlockDriver *drv = bs->drv;
> +    int64_t sector_num = offset >> BDRV_SECTOR_BITS;
> +    unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS;
> +
> +    assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
> +    assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
> +    assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);

So for now it is still enforcing 512-byte alignment, but gives us the
opportunity to relax things later.

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to