qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 01/17] block: Introduce bdrv_driver


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 01/17] block: Introduce bdrv_driver_preadv()
Date: Wed, 27 Apr 2016 07:52:04 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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 <address@hidden>
> ---
>  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 <address@hidden>

-- 
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

[Prev in Thread] Current Thread [Next in Thread]