From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmQ78-0005I7-QT for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:36:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmQ73-0005Eq-Pi for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:36:18 -0500 Received: from nodalink.pck.nerim.net ([62.212.105.220]:41807 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmQ73-0005DP-Dw for qemu-devel@nongnu.org; Fri, 29 Nov 2013 10:36:13 -0500 Date: Fri, 29 Nov 2013 16:36:04 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20131129153603.GA2817@irqsave.net> References: <1385636547-26826-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1385636547-26826-1-git-send-email-kwolf@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block: Use BDRV_O_NO_BACKING where appropriate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com Le Thursday 28 Nov 2013 =E0 12:02:27 (+0100), Kevin Wolf a =E9crit : > If you open an image temporarily just because you want to check its siz= e > or get it flushed, there's no real reason to open the whole backing fil= e > chain. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 3 ++- > block/qcow2.c | 3 ++- > block/vmdk.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/block.c b/block.c > index 03e45fc..e2745a5 100644 > --- a/block.c > +++ b/block.c > @@ -1061,7 +1061,8 @@ int bdrv_open(BlockDriverState *bs, const char *f= ilename, QDict *options, > /* Get the required size from the image */ > bs1 =3D bdrv_new(""); > QINCREF(options); > - ret =3D bdrv_open(bs1, filename, options, 0, drv, &local_err); > + ret =3D bdrv_open(bs1, filename, options, BDRV_O_NO_BACKING, > + drv, &local_err); > if (ret < 0) { > bdrv_unref(bs1); > goto fail; > diff --git a/block/qcow2.c b/block/qcow2.c > index 2fe37ed..8e2b6c7 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -1588,7 +1588,8 @@ static int qcow2_create2(const char *filename, in= t64_t total_size, > =20 > /* Reopen the image without BDRV_O_NO_FLUSH to flush it before ret= urning */ > ret =3D bdrv_open(bs, filename, NULL, > - BDRV_O_RDWR | BDRV_O_CACHE_WB, drv, &local_err); > + BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING, > + drv, &local_err); > if (error_is_set(&local_err)) { > error_propagate(errp, local_err); > goto out; > diff --git a/block/vmdk.c b/block/vmdk.c > index 6555663..5fb6c81 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -1690,7 +1690,7 @@ static int vmdk_create(const char *filename, QEMU= OptionParameter *options, > } > if (backing_file) { > BlockDriverState *bs =3D bdrv_new(""); > - ret =3D bdrv_open(bs, backing_file, NULL, 0, NULL, errp); > + ret =3D bdrv_open(bs, backing_file, NULL, BDRV_O_NO_BACKING, N= ULL, errp); > if (ret !=3D 0) { > bdrv_unref(bs); > return ret; > --=20 > 1.8.1.4 >=20 >=20 Reviewed-by: Benoit Canet No Tested-By as it doesn't apply to kevin/master yet.