[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/7] vdi: merge aio_read_cb and aio_write_cb into
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 3/7] vdi: merge aio_read_cb and aio_write_cb into callers |
Date: |
Mon, 19 Mar 2012 18:07:47 +0100 |
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>
---
block/vdi.c | 40 ++++++++++++----------------------------
1 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/block/vdi.c b/block/vdi.c
index 4b780db..9e5b169 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.7.6
- [Qemu-devel] [PATCH v2 0/7] vdi: convert to coroutines, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 1/7] vdi: basic conversion to coroutines, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 4/7] vdi: move aiocb fields to locals, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 5/7] vdi: leave bounce buffering to block layer, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 3/7] vdi: merge aio_read_cb and aio_write_cb into callers,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 6/7] vdi: do not create useless iovecs, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 2/7] vdi: move end-of-I/O handling at the end, Paolo Bonzini, 2012/03/19
- [Qemu-devel] [PATCH v2 7/7] vdi: change goto to loop, Paolo Bonzini, 2012/03/19
- Re: [Qemu-devel] [PATCH v2 0/7] vdi: convert to coroutines, Kevin Wolf, 2012/03/20