[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/46] vdi: merge aio_read_cb and aio_write_cb into
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 17/46] vdi: merge aio_read_cb and aio_write_cb into callers |
Date: |
Thu, 5 Apr 2012 17:51:55 +0200 |
From: Paolo Bonzini <address@hidden>
Now inline the former AIO callbacks into vdi_co_readv and vdi_co_writev.
While many cleanups are possible, the code now really looks synchronous.
Acked-by: Stefan Weil <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vdi.c | 40 ++++++++++++----------------------------
1 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/block/vdi.c b/block/vdi.c
index df0f431..407fccc 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -523,15 +523,19 @@ static VdiAIOCB *vdi_aio_setup(BlockDriverState *bs,
int64_t sector_num,
return acb;
}
-static int vdi_aio_read_cb(void *opaque, int ret)
+static int vdi_co_readv(BlockDriverState *bs,
+ int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
{
- VdiAIOCB *acb = opaque;
- BlockDriverState *bs = acb->common.bs;
+ VdiAIOCB *acb;
BDRVVdiState *s = bs->opaque;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t sector_in_block;
uint32_t n_sectors;
+ int ret;
+
+ logout("\n");
+ acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, 0);
restart:
block_index = acb->sector_num / s->block_sectors;
@@ -578,27 +582,19 @@ restart:
return ret;
}
-static int vdi_co_readv(BlockDriverState *bs,
+static int vdi_co_writev(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
{
VdiAIOCB *acb;
- int ret;
-
- logout("\n");
- acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, 0);
- ret = vdi_aio_read_cb(acb, 0);
- return ret;
-}
-
-static int vdi_aio_write_cb(void *opaque, int ret)
-{
- VdiAIOCB *acb = opaque;
- BlockDriverState *bs = acb->common.bs;
BDRVVdiState *s = bs->opaque;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t sector_in_block;
uint32_t n_sectors;
+ int ret;
+
+ logout("\n");
+ acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, 1);
restart:
block_index = acb->sector_num / s->block_sectors;
@@ -710,18 +706,6 @@ restart:
return ret;
}
-static int vdi_co_writev(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
-{
- VdiAIOCB *acb;
- int ret;
-
- logout("\n");
- acb = vdi_aio_setup(bs, sector_num, qiov, nb_sectors, 1);
- ret = vdi_aio_write_cb(acb, 0);
- return ret;
-}
-
static int vdi_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
--
1.7.6.5
- [Qemu-devel] [PULL 00/46] Block patches, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 03/46] qcow2: Remove unused parameter in get_cluster_table(), Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 02/46] tracetool: Forbid argument name 'next', Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 04/46] qemu-io: add option to enable tracing, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 01/46] trace-events: Rename 'next' argument, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 05/46] block: push recursive flushing up from drivers, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 06/46] aio: move BlockDriverAIOCB to qemu-aio.h, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 07/46] ide: IDENTIFY word 86 bit 14 is reserved, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 10/46] ide: Adds wwn=hex qdev option, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 08/46] ide: Add "model=s" qdev option, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 17/46] vdi: merge aio_read_cb and aio_write_cb into callers,
Kevin Wolf <=
- [Qemu-devel] [PATCH 18/46] vdi: move aiocb fields to locals, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 23/46] block: disable I/O throttling on sync api, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 24/46] block: cancel jobs when a device is ready to go away, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 22/46] Use DMADirection type for dma_bdrv_io, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 43/46] qed: add bdrv_invalidate_cache to be called after incoming live migration, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 37/46] qemu-iotests: Fix call syntax for qemu-img, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 38/46] qemu-iotests: Fix call syntax for qemu-io, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 28/46] qemu-img: add image fragmentation statistics, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 21/46] vdi: change goto to loop, Kevin Wolf, 2012/04/05
- [Qemu-devel] [PATCH 32/46] block: bdrv_append() fixes, Kevin Wolf, 2012/04/05