qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 07/17] cloop: Implement .bdrv_co_preadv() interf


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH 07/17] cloop: Implement .bdrv_co_preadv() interface
Date: Wed, 27 Apr 2016 15:12:37 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Apr 27, 2016 at 11:52:37AM +0200, Kevin Wolf wrote:
> -static int cloop_read(BlockDriverState *bs, int64_t sector_num,
> -                    uint8_t *buf, int nb_sectors)
> +static int coroutine_fn
> +cloop_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
> +                QEMUIOVector *qiov, int flags)
>  {
>      BDRVCloopState *s = bs->opaque;
> +    uint64_t sector_num = offset >> BDRV_SECTOR_BITS;
> +    int nb_sectors = bytes >> BDRV_SECTOR_BITS;
>      int i;
>  
> +    assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
> +    assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
> +
> +    qemu_co_mutex_lock(&s->lock);
> +
>      for (i = 0; i < nb_sectors; i++) {
> +        void *data;
>          uint32_t sector_offset_in_block =
>              ((sector_num + i) % s->sectors_per_block),
>              block_num = (sector_num + i) / s->sectors_per_block;
>          if (cloop_read_block(bs, block_num) != 0) {
>              return -1;

s->lock must be unlocked.

Attachment: signature.asc
Description: PGP signature


reply via email to

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