From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlvvx-000051-Nl for qemu-devel@nongnu.org; Tue, 13 Oct 2015 05:31:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlvvw-0006LT-Ry for qemu-devel@nongnu.org; Tue, 13 Oct 2015 05:31:49 -0400 Date: Tue, 13 Oct 2015 11:31:42 +0200 From: Kevin Wolf Message-ID: <20151013093142.GE4906@noname.str.redhat.com> References: <1444650651-26227-1-git-send-email-famz@redhat.com> <1444650651-26227-6-git-send-email-famz@redhat.com> <561BC33A.4030108@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <561BC33A.4030108@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 05/12] block: Introduce "drained begin/end" API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Stefan Hajnoczi , Fam Zheng , qemu-devel@nongnu.org, qemu-block@nongnu.org Am 12.10.2015 um 16:27 hat Paolo Bonzini geschrieben: > > > On 12/10/2015 13:50, Fam Zheng wrote: > > +void bdrv_drained_begin(BlockDriverState *bs) > > +{ > > + if (bs->quiesce_counter++) { > > + return; > > + } > > + aio_disable_external(bdrv_get_aio_context(bs)); > > + bdrv_drain(bs); > > +} > > I think bdrv_drain should be called unconditionally, i.e. before the > "if". This should also solve Kevin's doubt about new allocating write > request reenabling the timer: any write request from the drained section > happens normally, until you get a nested drain request and then the > callback completes the requests. This would mean that once you've sent an I/O request inside a drain section, you have to expect that more internal I/O might be going on after the request has completed. If you don't want this, you have to issue another bdrv_drain() or use a nested bdrv_drained_begin/end() section. Sounds reasonable enough to me, but I guess this should be explicitly documented. Kevin