Am 28.01.2013 18:07, schrieb Benoît Canet: > Signed-off-by: Benoit Canet <ben...@irqsave.net> > --- > block/quorum.c | 38 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > > diff --git a/block/quorum.c b/block/quorum.c > index 5d8470b..e3c6aad 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -73,15 +73,24 @@ static void quorum_aio_bh(void *opaque) > { > QuorumAIOCB *acb = opaque; > BDRVQuorumState *s = acb->bqs; > - int ret; > + int i, ret; > > ret = s->threshold <= acb->success_count ? 0 : -EIO; > > + for (i = 0; i < s->total; i++) { > + qemu_vfree(acb->aios[i].buf); > + acb->aios[i].buf = NULL; > + acb->aios[i].ret = 0; > + } > + > qemu_bh_delete(acb->bh); > acb->common.cb(acb->common.opaque, ret); > if (acb->finished) { > *acb->finished = true; > } > + for (i = 0; i < s->total; i++) { > + qemu_iovec_destroy(&acb->aios[i].qiov); > + } > g_free(acb->aios); > qemu_aio_release(acb); > }
Maybe I'm blind, but where do you actually write to the original buffer? As far as I can see, you only filled temporary buffers created in quorum_aio_readv. > @@ -140,6 +149,32 @@ static void quorum_aio_cb(void *opaque, int ret) > qemu_bh_schedule(acb->bh); > } > > +static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs, > + int64_t sector_num, > + QEMUIOVector *qiov, > + int nb_sectors, > + BlockDriverCompletionFunc *cb, > + void *opaque) > +{ > + BDRVQuorumState *s = bs->opaque; > + QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, > + nb_sectors, cb, opaque); > + int i; > + > + for (i = 0; i < s->total; i++) { > + acb->aios[i].buf = qemu_blockalign(bs->file, qiov->size); > + qemu_iovec_init(&acb->aios[i].qiov, qiov->niov); > + qemu_iovec_clone(&acb->aios[i].qiov, qiov, acb->aios[i].buf); > + } > + > + for (i = 0; i < s->total; i++) { > + bdrv_aio_readv(s->bs[i], sector_num, qiov, nb_sectors, > + quorum_aio_cb, &acb->aios[i]); > + } > + > + return &acb->common; > +} Kevin