From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP8hl-0007kE-0q for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:26:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP8hd-0007FT-SB for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:26:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP8hd-0007FM-LZ for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:26:17 -0400 From: Fam Zheng Date: Wed, 3 Sep 2014 19:23:50 +0800 Message-Id: <1409743435-21155-16-git-send-email-famz@redhat.com> In-Reply-To: <1409743435-21155-1-git-send-email-famz@redhat.com> References: <1409743435-21155-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v4 15/20] 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 , Chrysostomos Nanakos , Stefan Hajnoczi , Liu Yuan , Peter Lieven , Ronnie Sahlberg , Josh Durgin , Paolo Bonzini , MORITA Kazutaka , Benoit Canet 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 093382e..0951d52 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -138,16 +138,13 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) /* cancel all callbacks */ for (i = 0; i < s->num_children; i++) { - 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) -- 2.1.0.27.g96db324