From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axtlw-0007HE-Ac for qemu-devel@nongnu.org; Wed, 04 May 2016 06:11:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axtlk-00065i-FU for qemu-devel@nongnu.org; Wed, 04 May 2016 06:11:06 -0400 Date: Wed, 4 May 2016 12:10:23 +0200 From: Kevin Wolf Message-ID: <20160504101023.GB14972@noname.str.redhat.com> References: <1461030177-29144-1-git-send-email-famz@redhat.com> <1461030177-29144-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1461030177-29144-2-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] block: Invalidate all children List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Max Reitz , qemu-block@nongnu.org Am 19.04.2016 um 03:42 hat Fam Zheng geschrieben: > Currently we only recurse to bs->file, which will miss the children in quorum > and VMDK. > > Recurse into the whole subtree to avoid that. > > Signed-off-by: Fam Zheng > --- > block.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/block.c b/block.c > index d4939b4..fa8b38f 100644 > --- a/block.c > +++ b/block.c > @@ -3201,6 +3201,7 @@ void bdrv_init_with_whitelist(void) > > void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) > { > + BdrvChild *child; > Error *local_err = NULL; > int ret; > > @@ -3215,13 +3216,20 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) > > if (bs->drv->bdrv_invalidate_cache) { > bs->drv->bdrv_invalidate_cache(bs, &local_err); > - } else if (bs->file) { > - bdrv_invalidate_cache(bs->file->bs, &local_err); The old behaviour was that we only recurse for bs->file if the block driver doesn't have its own implementation. This means that in qcow2, for example, we call bdrv_invalidate_cache() explicitly for bs->file. If we can already invalidate it here, the call inside qcow2 and probably other drivers could go away. Kevin