From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZviuU-00052n-O0 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 04:38:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZviuT-0007Pu-Rz for qemu-devel@nongnu.org; Mon, 09 Nov 2015 04:38:46 -0500 Date: Mon, 9 Nov 2015 17:38:36 +0800 From: Fam Zheng Message-ID: <20151109093836.GB18363@ad.usersys.redhat.com> References: <1447037808-31886-1-git-send-email-famz@redhat.com> <1447037808-31886-9-git-send-email-famz@redhat.com> <5640663E.9020107@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5640663E.9020107@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 8/9] block: Introduce BlockDriver.bdrv_drain callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Stefan Hajnoczi , qemu-block@nongnu.org, Peter Lieven , qemu-devel@nongnu.org, Ronnie Sahlberg On Mon, 11/09 10:24, Paolo Bonzini wrote: > > > On 09/11/2015 03:56, Fam Zheng wrote: > > + if (bs->drv && bs->drv->bdrv_drain) { > > + bs->drv->bdrv_drain(bs); > > + } > > + QLIST_FOREACH(child, &bs->children, next) { > > + BlockDriverState *cbs = child->bs; > > + if (cbs->drv && cbs->drv->bdrv_drain) { > > + cbs->drv->bdrv_drain(bs); > > + } > > + } > > I think this is not enough, because the children could have children as > well. > > Perhaps you can do it like bdrv_flush: one function does the call to > bdrv_drain and the recursion on children; bdrv_drain calls that one > function and then does the "while (busy)" loop. > Right, this function is no longer recursive and only goes to one layer down. Will fix. Thanks, Fam