From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5ywl-0005ey-3O for qemu-devel@nongnu.org; Wed, 22 Jan 2014 09:38:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5ywg-0003Nz-2z for qemu-devel@nongnu.org; Wed, 22 Jan 2014 09:38:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5ywf-0003NX-RH for qemu-devel@nongnu.org; Wed, 22 Jan 2014 09:38:22 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0MD79dB016642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Jan 2014 08:07:10 -0500 Message-ID: <52DFC27C.3040802@redhat.com> Date: Wed, 22 Jan 2014 06:07:08 -0700 From: Eric Blake MIME-Version: 1.0 References: <1390361416-24234-1-git-send-email-famz@redhat.com> In-Reply-To: <1390361416-24234-1-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xHtIQK6w8TkfH6dnvWEVlPkapTMGsSWcS" Subject: Re: [Qemu-devel] [PATCH] qapi: Add "backing" and "file" to BlockStats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xHtIQK6w8TkfH6dnvWEVlPkapTMGsSWcS Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/21/2014 08:30 PM, Fam Zheng wrote: > Currently there is no way to query BlockStats of the backing chain. Thi= s > adds "backing" and "file" fields into BlockStats to make it possible. >=20 > The old optional field "parent", which has the information for "file", > is kept there for backward compatibility, as an alias for "file". Eww. BlockStats is a big struct (and getting bigger), which means this is a lot of JSON duplication to send over the wire just to get discarded (no matter whether the client uses the old or the new name). > However field name "file" is more consistent with "file" option name in= > the block device configuration interface. Consistency is nice, but back-compat and efficiency take higher priority in this case. You are better off documenting that 'parent' refers to the details of the backing file, without adding a 'file' field. >=20 > Signed-off-by: Fam Zheng > --- > block/qapi.c | 7 +++++++ > qapi-schema.json | 15 +++++++++++---- > 2 files changed, 18 insertions(+), 4 deletions(-) >=20 > +++ b/block/qapi.c > @@ -316,6 +316,13 @@ BlockStats *bdrv_query_stats(const BlockDriverStat= e *bs) > if (bs->file) { > s->has_parent =3D true; > s->parent =3D bdrv_query_stats(bs->file); > + s->has_file =3D true; > + s->file =3D bdrv_query_stats(bs->file); > + } Drop this portion. > + > + if (bs->backing_hd) { > + s->has_backing =3D true; > + s->backing =3D bdrv_query_stats(bs->backing_hd); > } But this one is fine. > =20 > return s; > diff --git a/qapi-schema.json b/qapi-schema.json > index f27c48a..c3c8aec 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -1022,15 +1022,22 @@ > # > # @stats: A @BlockDeviceStats for the device. > # > -# @parent: #optional This may point to the backing block device if thi= s is a > -# a virtual block device. If it's a backing block, this will= point > -# to the backing file is one is present. I'm okay if you improve the wording here, but keep this field untouched with just a better description. > +# @file: #optional This may point to the file block device if presen= t. > +# (Since 2.0) Don't add this field. > +# > +# @backing: #optional This may point to the backing block device if pr= esent. > +# (Since 2.0) > +# s/may point/describes/ > +# @parent: #optional An alias of @file for backward comatibility. (Sin= ce > +# 0.14.0) s/comatibility/compatibility/ - except that I don't think you want to keep it as an alias. Also, the (Since 0.14.0) is bogus, since the field has existed for as long as the command has. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xHtIQK6w8TkfH6dnvWEVlPkapTMGsSWcS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJS38J8AAoJEKeha0olJ0NqLSgIAJBRzF38sKXJrDikmAobakX+ 4Bd7cqhulxK7DkweZsk416vQyj8lCf9f2lBv8V2JwdNz0bsJPzQ90ji0IyNW/d6D P+ohar/3gA6jVkPLi9PqqQ5y3brTuSuCfLVPpc8VBDjIK9BEH0beDDS/KPgAE6eu h9fiNr6OD0E3CCVvwONG5iRJzitwSkCgjCKG/SuHdMfCN/SFU8uNyf0E8/INLS44 en5GY2WAdp6TsB1JfQ3uJGAsTEeXGeLXqyOQl+9bAz7vlcUzfTfWXMjAFTj7BhK2 H8GrnEPcscrlrWfYhwmvfpcnYOAbdaZsotBMzlKo14COaB771zgNVG4xqhYckU0= =Md4g -----END PGP SIGNATURE----- --xHtIQK6w8TkfH6dnvWEVlPkapTMGsSWcS--