From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0DvM-0006gd-Kj for qemu-devel@nongnu.org; Fri, 19 Jul 2013 12:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0DvL-0007hv-E4 for qemu-devel@nongnu.org; Fri, 19 Jul 2013 12:52:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0DvL-0007ho-5q for qemu-devel@nongnu.org; Fri, 19 Jul 2013 12:52:55 -0400 Message-ID: <51E96EDE.6080208@redhat.com> Date: Fri, 19 Jul 2013 10:52:46 -0600 From: Eric Blake MIME-Version: 1.0 References: <1373992168-26043-1-git-send-email-pbonzini@redhat.com> <1373992168-26043-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1373992168-26043-11-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DeSqX5EA1dufBnqnHDhDVmesXu4sFUFdk" Subject: Re: [Qemu-devel] [PATCH v2 10/17] block: define get_block_status return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: famz@redhat.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DeSqX5EA1dufBnqnHDhDVmesXu4sFUFdk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/16/2013 10:29 AM, Paolo Bonzini wrote: > Define the return value of get_block_status. Bits 0, 1, 2 and 9-62 > are valid; bit 63 (the sign bit) is reserved for errors. Bits 3-7 bits 3-8, actually > are left for future extensions. >=20 > The return code is compatible with the old is_allocated API: returning > just 0 or 1 (aka BDRV_BLOCK_DATA) will not cause any behavioral change > in clients of is_allocated. We will return more precise information > in the next patches. >=20 > Signed-off-by: Paolo Bonzini > --- > v1->v2: improved comment >=20 > block.c | 7 +++++-- > include/block/block.h | 26 ++++++++++++++++++++++++++ > 2 files changed, 31 insertions(+), 2 deletions(-) >=20 > +++ b/include/block/block.h > @@ -81,6 +81,32 @@ typedef struct BlockDevOps { > #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) > #define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) > =20 > +/* BDRV_BLOCK_DATA: data is read from bs->file or another file > + * BDRV_BLOCK_ZERO: sectors read as zero > + * BDRV_BLOCK_OFFSET_VALID: sector stored in bs->file as raw data > + * > + * If BDRV_BLOCK_OFFSET_VALID is set, bits 9-62 represent the offset i= n > + * bs->file where sector data can be read from as raw data. And handy that the offset happens to be aligned to the current 512 sector size, so you can just mask without shifting to get an aligned offset to the start of the sector. > + * > + * DATA =3D=3D 0 && ZERO =3D=3D 0 means that data is read from backing= _hd if present. > + * > + * DATA ZERO OFFSET_VALID > + * t t t sectors read as zero, bs->file is zero at of= fset > + * t f t sectors read as valid from bs->file at offse= t > + * f t t sectors preallocated, read as zero, bs->file= not > + * necessarily zero at offset > + * f f t sectors preallocated but read from backing_h= d, > + * bs->file contains garbage at offset > + * t t f sectors preallocated, read as zero, unknown = offset > + * t f f sectors read from unknown file or offset > + * f t f not allocated or unknown offset, read as zer= o > + * f f f not allocated or unknown offset, read from b= acking_hd Makes sense. No further comments beyond other reviewers, if you want to add: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DeSqX5EA1dufBnqnHDhDVmesXu4sFUFdk 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR6W7eAAoJEKeha0olJ0NqCWgH/jcWxpduz2OGAijab+H57BCh IeAJCNcqLDdJGvw9jOJTpXjkOZ7dbNJHeawdSsEoiGchAVow418ApWfBa1OF5KnO +xuL/GxIm2+TpwRKk0q6SUEB0ulGwzmfwMCmZX/bVE+eq5CVpeF5dxWQN0ft8uED WFTmlcoiN2EqBhIFXj8EdrESHh7BJZSj3jyO48Gbn8Id45UGwdxYJn66ZLKtmyRH FgYQo+WWb8EuDxuhF58Ba4eDwa+nEy422ZhhLWxK/PHX7Qy+hqpIbRPqDxZsFCOm adZYmdKV6oeT8nCrtneM9I9yR8a8M0+n/cK7IL8n8FmNdBrY0TqsevnBRsWUQa0= =08/y -----END PGP SIGNATURE----- --DeSqX5EA1dufBnqnHDhDVmesXu4sFUFdk--