[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/17] cloop: Implement .bdrv_co_preadv() interf
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [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.
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH 02/17] block: Introduce bdrv_driver_pwritev(), (continued)
- [Qemu-devel] [PATCH 02/17] block: Introduce bdrv_driver_pwritev(), Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 03/17] block: Support AIO drivers in bdrv_driver_preadv/pwritev(), Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 04/17] block: Rename bdrv_co_do_preadv/writev to bdrv_co_preadv/writev, Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 05/17] block: Introduce .bdrv_co_preadv/pwritev BlockDriver function, Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 07/17] cloop: Implement .bdrv_co_preadv() interface, Kevin Wolf, 2016/04/27
- Re: [Qemu-devel] [PATCH 07/17] cloop: Implement .bdrv_co_preadv() interface,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 08/17] dmg: Implement .bdrv_co_preadv() interface, Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 09/17] vdi: Implement .bdrv_co_preadv() interface, Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 10/17] vdi: Implement .bdrv_co_pwritev() interface, Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 11/17] vmdk: Add vmdk_find_offset_in_cluster(), Kevin Wolf, 2016/04/27
- [Qemu-devel] [PATCH 06/17] bochs: Implement .bdrv_co_preadv() interface, Kevin Wolf, 2016/04/27