From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zle4V-0001S6-Ra for qemu-devel@nongnu.org; Mon, 12 Oct 2015 10:27:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zle4R-000476-S3 for qemu-devel@nongnu.org; Mon, 12 Oct 2015 10:27:27 -0400 Sender: Paolo Bonzini References: <1444650651-26227-1-git-send-email-famz@redhat.com> <1444650651-26227-6-git-send-email-famz@redhat.com> From: Paolo Bonzini Message-ID: <561BC33A.4030108@redhat.com> Date: Mon, 12 Oct 2015 16:27:06 +0200 MIME-Version: 1.0 In-Reply-To: <1444650651-26227-6-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , qemu-block@nongnu.org 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. Paolo