From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmCew-000115-TT for qemu-devel@nongnu.org; Thu, 28 Nov 2013 20:14:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmCeq-0003io-SY for qemu-devel@nongnu.org; Thu, 28 Nov 2013 20:14:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmCeq-0003ii-KX for qemu-devel@nongnu.org; Thu, 28 Nov 2013 20:14:12 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAT1EBaG006169 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Nov 2013 20:14:11 -0500 Message-ID: <5297EA5B.1060207@redhat.com> Date: Fri, 29 Nov 2013 09:14:03 +0800 From: Fam Zheng MIME-Version: 1.0 References: <1385636547-26826-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1385636547-26826-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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 , qemu-devel@nongnu.org Cc: stefanha@redhat.com, mreitz@redhat.com On 2013=E5=B9=B411=E6=9C=8828=E6=97=A5 19:02, Kevin Wolf wrote: > 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. > > Signed-off-by: Kevin Wolf > --- > block.c | 3 ++- > block/qcow2.c | 3 ++- > block/vmdk.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) > > 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, > > /* Reopen the image without BDRV_O_NO_FLUSH to flush it before re= turning */ > 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; > Reviewed-by: Fam Zheng