From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agO63-0004Lj-Pa for qemu-devel@nongnu.org; Wed, 16 Mar 2016 22:55:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agO62-0003k8-QE for qemu-devel@nongnu.org; Wed, 16 Mar 2016 22:55:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agO62-0003ju-Jv for qemu-devel@nongnu.org; Wed, 16 Mar 2016 22:55:34 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 31FFF7F09D for ; Thu, 17 Mar 2016 02:55:34 +0000 (UTC) Date: Thu, 17 Mar 2016 10:55:32 +0800 From: Fam Zheng Message-ID: <20160317025532.GK23821@ad.usersys.redhat.com> References: <1458137817-15383-1-git-send-email-pbonzini@redhat.com> <1458137817-15383-10-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458137817-15383-10-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 09/16] block: wait for all pending I/O when doing synchronous requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Wed, 03/16 15:16, Paolo Bonzini wrote: > Synchronous I/O should in general happen either in the main thread (e.g. > for bdrv_open and bdrv_create) or between bdrv_drained_begin and > bdrv_drained_end. Therefore, the simplest way to wait for it to finish > is to wait for _all_ pending I/O to complete. > > In fact, there was one case in bdrv_close where we explicitly drained > after bdrv_flush; this is now unnecessary. And we should probably have > called bdrv_drain_all after calls to bdrv_flush_all, which is now > unnecessary too. > > This decouples synchronous I/O from aio_poll. When the request used > not to be tracked as part of bdrv_drain (e.g. bdrv_co_get_block_status) > we need to update the in_flight count. > > Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng