From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD8S8-0005FZ-OR for qemu-devel@nongnu.org; Tue, 11 Feb 2014 03:12:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WD8Rz-0001je-93 for qemu-devel@nongnu.org; Tue, 11 Feb 2014 03:12:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD8Rz-0001jZ-0I for qemu-devel@nongnu.org; Tue, 11 Feb 2014 03:12:15 -0500 Date: Tue, 11 Feb 2014 16:12:17 +0800 From: Fam Zheng Message-ID: <20140211081217.GB12675@T430.nay.redhat.com> References: <1392068957-14184-1-git-send-email-benoit.canet@irqsave.net> <1392068957-14184-2-git-send-email-benoit.canet@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1392068957-14184-2-git-send-email-benoit.canet@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [FIX V2] block: Fix device snapshots broken by the block filter snapshots patchset. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: kwolf@redhat.com, Benoit Canet , qemu-devel@nongnu.org, jcody@redhat.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com On Mon, 02/10 22:49, Beno=EEt Canet wrote: > Take into account the fact that a block filter like quorum will be in b= s->file > while a regular block driver device is really on the top level. >=20 > Signed-off-by: Benoit Canet > --- > block.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) >=20 > diff --git a/block.c b/block.c > index 07ac50a..d04f535 100644 > --- a/block.c > +++ b/block.c > @@ -5400,14 +5400,16 @@ bool bdrv_is_first_non_filter(BlockDriverState = *candidate) > =20 > /* walk down the bs forest recursively */ > QTAILQ_FOREACH(bs, &bdrv_states, device_list) { > - bool perm; > - > - if (!bs->file) { > - continue; > + bool perm =3D false; > + > + if (bs->file && > + bs->file->drv && > + bs->file->drv->authorizations[BS_IS_A_FILTER]) { > + perm =3D bdrv_recurse_is_first_non_filter(bs->file, candid= ate); > + } else if (bs =3D=3D candidate) { > + perm =3D true; > } > =20 > - perm =3D bdrv_recurse_is_first_non_filter(bs->file, candidate)= ; > - > /* candidate is the first non filter */ > if (perm) { > return true; With this change, if the top level driver has ->file, its implementation = of .bdrv_recurse_is_first_non_filter() is skipped and bs->file is the start = point. So we have an implication that single child block drivers (that has ->fil= e) doesn't need to, and shouldn't implement this operation, as commentted ab= ove bdrv_generic_is_first_non_filter. Tested that this patch fixes the external snapshot problem, but didn't te= st the "quorum as bs->file case". Thanks, Reviewed-by: Fam Zheng