Received: from eggs.gnu.org ([2001:4830:134:3::10]:60168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRxA2-0004hG-V3 for qemu-devel@nongnu.org; Thu, 11 Sep 2014 01:43:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRx9w-0006DR-Ej for qemu-devel@nongnu.org; Thu, 11 Sep 2014 01:43:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRx9w-0006DG-83 for qemu-devel@nongnu.org; Thu, 11 Sep 2014 01:43:08 -0400 From: Fam Zheng Date: Thu, 11 Sep 2014 13:41:22 +0800 Message-Id: <1410414088-4419-17-git-send-email-famz@redhat.com> In-Reply-To: <1410414088-4419-1-git-send-email-famz@redhat.com> References: <1410414088-4419-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v6 16/22] quorum: Convert quorum_aiocb_info.cancel to .cancel_async List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Benoit Canet , Peter Lieven , Stefan Hajnoczi , Liu Yuan , Paolo Bonzini Before, we cancel all the child requests with bdrv_aio_cancel, then free the acb.. Now we just kick off asynchronous cancellation of child requests and return, we know quorum_aio_cb will be called later, so in the end quorum_aio_finalize will take care of calling the caller's cb. Signed-off-by: Fam Zheng --- block/quorum.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 41c4249..f343c04 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -139,17 +139,14 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) /* cancel all callbacks */ for (i = 0; i < s->num_children; i++) { if (acb->qcrs[i].aiocb) { - bdrv_aio_cancel(acb->qcrs[i].aiocb); + bdrv_aio_cancel_async(acb->qcrs[i].aiocb); } } - - g_free(acb->qcrs); - qemu_aio_release(acb); } static AIOCBInfo quorum_aiocb_info = { .aiocb_size = sizeof(QuorumAIOCB), - .cancel = quorum_aio_cancel, + .cancel_async = quorum_aio_cancel, }; static void quorum_aio_finalize(QuorumAIOCB *acb) -- 1.9.3