From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSL04-0007KK-47 for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSL00-0003Yf-Mb for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:03 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:47065 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSL00-0003XE-CA for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:00 -0400 From: Peter Lieven Date: Thu, 20 Aug 2015 10:14:07 +0200 Message-Id: <1440058448-27847-2-git-send-email-pl@kamp.de> In-Reply-To: <1440058448-27847-1-git-send-email-pl@kamp.de> References: <1440058448-27847-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCH 1/2] block/io: allow AIOCB without callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com, Peter Lieven , jsnow@redhat.com, pbonzini@redhat.com If the backend storage is unresponsive and we cancel a request due to a timeout we cannot immediately destroy the AIOCB because the storage might complete the original request laster if it is responsive again. For this purpose allow to set the callback to NULL and ignore it in this case. Signed-off-by: Peter Lieven --- block/io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/io.c b/block/io.c index d4bc83b..e628581 100644 --- a/block/io.c +++ b/block/io.c @@ -2007,7 +2007,9 @@ static void bdrv_aio_bh_cb(void *opaque) qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); } qemu_vfree(acb->bounce); - acb->common.cb(acb->common.opaque, acb->ret); + if (acb->common.cb) { + acb->common.cb(acb->common.opaque, acb->ret); + } qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_unref(acb); @@ -2075,7 +2077,9 @@ static const AIOCBInfo bdrv_em_co_aiocb_info = { static void bdrv_co_complete(BlockAIOCBCoroutine *acb) { if (!acb->need_bh) { - acb->common.cb(acb->common.opaque, acb->req.error); + if (acb->common.cb) { + acb->common.cb(acb->common.opaque, acb->req.error); + } qemu_aio_unref(acb); } } -- 1.9.1