From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2KCD-0006Ec-5a for qemu-devel@nongnu.org; Wed, 02 Jul 2014 09:03:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2KC8-0004Td-NY for qemu-devel@nongnu.org; Wed, 02 Jul 2014 09:03:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2KC8-0004TY-Dr for qemu-devel@nongnu.org; Wed, 02 Jul 2014 09:03:28 -0400 Message-ID: <53B4031E.3030400@redhat.com> Date: Wed, 02 Jul 2014 07:03:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1404294640-16360-1-git-send-email-cyliu@suse.com> In-Reply-To: <1404294640-16360-1-git-send-email-cyliu@suse.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KvQr1ei9d0RPOI7gxj7IskDsv8Jjm44SH" Subject: Re: [Qemu-devel] [PATCH] qemu-img info: show nocow info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu , stefanha@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KvQr1ei9d0RPOI7gxj7IskDsv8Jjm44SH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/02/2014 03:50 AM, Chunyan Liu wrote: > Add nocow info in 'qemu-img info' output to show whether the file > currently has NOCOW flag set or not. >=20 > Signed-off-by: Chunyan Liu > --- > block/qapi.c | 25 +++++++++++++++++++++++++ > qapi/block-core.json | 3 ++- > 2 files changed, 27 insertions(+), 1 deletion(-) >=20 > + > + /* get NOCOW info */ > + fd =3D qemu_open(bs->filename, O_RDONLY | O_NONBLOCK); > + if (fd >=3D 0) { > + if (ioctl(fd, FS_IOC_GETFLAGS, &attr) =3D=3D 0 && (attr & FS_N= OCOW_FL)) { > + info->has_nocow =3D true; > + info->nocow =3D true; Better is: if (ioctl... =3D=3D 0) { info->has_nocow =3D true; info->nocow =3D !!(attr & FS_NOCOW_FL) } to explicitly document the cases where we know nocow works but is not set (and omitting it in cases where nocow doesn't exist because of the fs= ) > +++ b/qapi/block-core.json > @@ -126,7 +126,8 @@ > '*backing-filename': 'str', '*full-backing-filename': 'str'= , > '*backing-filename-format': 'str', '*snapshots': ['Snapshot= Info'], > '*backing-image': 'ImageInfo', > - '*format-specific': 'ImageInfoSpecific' } } > + '*format-specific': 'ImageInfoSpecific', > + '*nocow': 'bool' } } Missing documentation. When adding that, remember to add '(since 2.2)' (or even since 2.1 if you think this is a bug fix that should go in during hard freeze) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KvQr1ei9d0RPOI7gxj7IskDsv8Jjm44SH 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/ iQEcBAEBCAAGBQJTtAMeAAoJEKeha0olJ0Nq0+8IAIt57r59gUEkqFezBsmvuEzl fX/Kv8vP6HmHIKSzobpVNJnqUSOLhqXGRsOTFf2sxbDO+iI/wvEBsntQIFot2N+u u3ErQpEOq70do6UFsa6M7Lc1hw89irL5a4X4ccU4b41R6JTkGp/NY2ukvy3LFmlc cFtN6vKDz0A6P55LUMrepeSM16bMuxrMbe8LIwnqrbEyp7NAvRIfCPxGkchUUEET ldx6EZlvDjuGQtd36EW0X1FVmh1wb9jSsrdqE8u3cMdUZezWKN3/DhoBUEqD3e0x HrBwIIx+qs5hlenGmQ+fisjNcJC/hHbmrGsQ/mF5+guq9ncyFRzrmxjGv/hP59o= =Hfuq -----END PGP SIGNATURE----- --KvQr1ei9d0RPOI7gxj7IskDsv8Jjm44SH--