[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv.
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv. |
Date: |
Wed, 8 Aug 2012 16:44:40 +0100 |
On Tue, Aug 7, 2012 at 2:44 PM, Benoît Canet <address@hidden> wrote:
> Signed-off-by: Benoit Canet <address@hidden>
> ---
> block/quorum.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index 2df3ae6..13804c1 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -174,6 +174,14 @@ static int quorum_check_ret(QuorumAIOCB *acb)
> static void quorum_aio_bh(void *opaque)
> {
> QuorumAIOCB *acb = opaque;
> + int i;
> +
> + for (i = 0; i <= 2; i++) {
> + if (acb->aios[i].buf) {
> + g_free(acb->aios[i].buf);
> + acb->aios[i].buf = NULL;
> + }
qemu_blockalign() buffers must be freed using qemu_vfree(). Also
qemu_vfree(NULL) is a nop so there no need for if (acb->aios[i].buf),
it can be done unconditionally.
> + }
>
> qemu_bh_delete(acb->bh);
> acb->common.cb(acb->common.opaque, quorum_check_ret(acb));
> @@ -224,6 +232,32 @@ static void quorum_aio_cb(void *opaque, int ret)
> }
> }
>
> +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(bs, qiov, sector_num,
> + nb_sectors, cb, opaque);
> + int i;
> +
> + for (i = 0; i <= 2; i++) {
> + acb->aios[i].buf = qemu_blockalign(bs->file, qiov->size);
> + qemu_iovec_init(&acb->qiovs[i], qiov->niov);
> + blkverify_iovec_clone(&acb->qiovs[i], qiov, acb->aios[i].buf);
> + }
> +
> + for (i = 0; i <= 2; i++) {
> + bdrv_aio_readv(s->bs[i], sector_num, qiov, nb_sectors,
> + quorum_aio_cb, &acb->aios[i]);
acb->qiovs[i] instead of qiov.
[Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv., Benoît Canet, 2012/08/07
- Re: [Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv.,
Stefan Hajnoczi <=
[Qemu-devel] [RFC V2 07/10] blkverify: Make blkverify_iovec_clone() and blkverify_iovec_compare() public, Benoît Canet, 2012/08/07
[Qemu-devel] [RFC V2 10/10] quorum: Add quorum mechanism., Benoît Canet, 2012/08/07
Re: [Qemu-devel] [PATCH 00/10] Quorum disk image corruption resiliency, Stefan Hajnoczi, 2012/08/08