|
From: | Max Reitz |
Subject: | Re: [Qemu-devel] [PATCH V10 05/13] quorum: Add quorum_aio_readv. |
Date: | Fri, 31 Jan 2014 22:47:22 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 28.01.2014 17:52, Benoît Canet wrote:
From: Benoît Canet <address@hidden> Signed-off-by: Benoit Canet <address@hidden> --- block/quorum.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/block/quorum.c b/block/quorum.c index 85992ab..5bf37b3 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -101,14 +101,23 @@ static int quorum_get_first_error(QuorumAIOCB *acb) static void quorum_aio_finalize(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->bqs; - int ret; + int i, ret;ret = s->threshold <= acb->success_count ? 0 : quorum_get_first_error(acb); + for (i = 0; i < s->total; i++) {+ qemu_vfree(acb->aios[i].buf); + acb->aios[i].buf = NULL; + acb->aios[i].ret = 0; + }
With “fields” I mean these as well (they are not set for write operations). ;-)
But as I've said before, it doesn't actually make a difference whether this is just executed for reads or also for writes, where these fields are NULL and 0 already anyway, so:
Reviewed-by: Max Reitz <address@hidden>
+ acb->common.cb(acb->common.opaque, ret); if (acb->finished) { *acb->finished = true; } + for (i = 0; acb->is_read && i < s->total; i++) {
This is a pretty elegant way to avoid an “if” around the loop, I have to admit. *g*
Max
[Prev in Thread] | Current Thread | [Next in Thread] |