From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP8kG-0003vw-TC for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP8kA-0007u3-J0 for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:29:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP8kA-0007tx-Bk for qemu-devel@nongnu.org; Wed, 03 Sep 2014 07:28:54 -0400 Message-ID: <5406FB57.7070900@redhat.com> Date: Wed, 03 Sep 2014 13:28:23 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409743435-21155-1-git-send-email-famz@redhat.com> <1409743435-21155-5-git-send-email-famz@redhat.com> In-Reply-To: <1409743435-21155-5-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 04/20] block: Convert bdrv_em_aiocb_info.cancel to .cancel_async List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Chrysostomos Nanakos , Stefan Hajnoczi , Peter Lieven , Ronnie Sahlberg , Liu Yuan , Josh Durgin , MORITA Kazutaka , Benoit Canet Il 03/09/2014 13:23, Fam Zheng ha scritto: > All the difference is that the old .cancel doesn't call cb, but > .cancel_async does. This requires auditing all callbacks though, doesn't it? Or at least adding an if (ret == -ECANCELED) { return; } at the beginning. Paolo > Signed-off-by: Fam Zheng > --- > block.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/block.c b/block.c > index 4aa1bd7..b7253af 100644 > --- a/block.c > +++ b/block.c > @@ -4679,6 +4679,9 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) > { > BlockDriverAIOCBSync *acb = > container_of(blockacb, BlockDriverAIOCBSync, common); > + > + acb->ret = -ECANCELED; > + acb->common.cb(acb->common.opaque, acb->ret); > qemu_bh_delete(acb->bh); > acb->bh = NULL; > qemu_aio_release(acb); > @@ -4686,7 +4689,7 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb) > > static const AIOCBInfo bdrv_em_aiocb_info = { > .aiocb_size = sizeof(BlockDriverAIOCBSync), > - .cancel = bdrv_aio_cancel_em, > + .cancel_async = bdrv_aio_cancel_em, > }; > > static void bdrv_aio_bh_cb(void *opaque) >