From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuO4y-0007qo-Iu for qemu-devel@nongnu.org; Thu, 05 Nov 2015 12:12:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuO4x-0002Vv-NF for qemu-devel@nongnu.org; Thu, 05 Nov 2015 12:12:04 -0500 References: <1446084866-12451-1-git-send-email-famz@redhat.com> <1446084866-12451-9-git-send-email-famz@redhat.com> <20151105163539.GB1702@stefanha-x1.localdomain> From: Paolo Bonzini Message-ID: <563B8DDB.1000304@redhat.com> Date: Thu, 5 Nov 2015 18:11:55 +0100 MIME-Version: 1.0 In-Reply-To: <20151105163539.GB1702@stefanha-x1.localdomain> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 8/9] block: Introduce BlockDriver.bdrv_drain callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, Peter Lieven , qemu-devel@nongnu.org, Ronnie Sahlberg On 05/11/2015 17:35, Stefan Hajnoczi wrote: >> > void bdrv_drain(BlockDriverState *bs) >> > { >> > + BdrvChild *child; >> > bool busy = true; >> > >> > + if (bs->drv && bs->drv->bdrv_drain) { >> > + bs->drv->bdrv_drain(bs); >> > + } >> > + QLIST_FOREACH(child, &bs->children, next) { >> > + bdrv_drain(child->bs); >> > + } >> > while (busy) { >> > /* Keep iterating */ >> > bdrv_flush_io_queue(bs); > Recursing calls aio_poll() once for each BDS node and I think it's not > necessary and could be a performance problem. Indeed, only the call to bs->drv->bdrv_drain should be done recursively. Paolo