From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMksa-0005mL-0x for qemu-devel@nongnu.org; Thu, 19 Sep 2013 16:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMksS-0006EY-PP for qemu-devel@nongnu.org; Thu, 19 Sep 2013 16:31:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMksS-0006EC-Fi for qemu-devel@nongnu.org; Thu, 19 Sep 2013 16:31:04 -0400 Message-ID: <523B5EF0.5030201@redhat.com> Date: Thu, 19 Sep 2013 14:30:40 -0600 From: Eric Blake MIME-Version: 1.0 References: <1379425736-11326-1-git-send-email-pl@kamp.de> <1379425736-11326-18-git-send-email-pl@kamp.de> In-Reply-To: <1379425736-11326-18-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MhFMjAhI8fRr5lpNNNXuQVRgPRfiBPK6E" Subject: Re: [Qemu-devel] [PATCHv2 17/20] block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, stefanha@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --MhFMjAhI8fRr5lpNNNXuQVRgPRfiBPK6E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/17/2013 07:48 AM, Peter Lieven wrote: > this patch does 2 things: > a) only do additional call outs if BDRV_BLOCK_ZERO is not already set. > b) use the newly introduced bdrv_has_discard_zeroes() to return the > zero state of an unallocated block. the used callout to > bdrv_has_zero_init() is only valid right after bdrv_create. >=20 > Signed-off-by: Peter Lieven > --- > block.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Eric Blake >=20 > diff --git a/block.c b/block.c > index 64fca1b..7d7ee0f 100644 > --- a/block.c > +++ b/block.c > @@ -3192,8 +3192,8 @@ static int64_t coroutine_fn bdrv_co_get_block_sta= tus(BlockDriverState *bs, > return ret; > } > =20 > - if (!(ret & BDRV_BLOCK_DATA)) { > - if (bdrv_has_zero_init(bs)) { > + if (!(ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO)) {=20 > + if (bdrv_has_discard_zeroes(bs)) { > ret |=3D BDRV_BLOCK_ZERO; > } else if (bs->backing_hd) { > BlockDriverState *bs2 =3D bs->backing_hd; >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --MhFMjAhI8fRr5lpNNNXuQVRgPRfiBPK6E 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.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSO17wAAoJEKeha0olJ0NqPIQIAJ9Ys6V0GHkgF5YqZp5ApJMy 5g94X/4Fgs5ta5aq8wGOtl0YRxt4X25glz2Oocds305s2lhkk7CSMdJ0a8LRBJci 8Vl3Urofj+AsEsfgo/q/9QM5pN3vRiDWbT18Dwq8hbpw2F/OqPd80JjErQemk/Sb GE6/V7k9mrf0jegHdXG9YYFJbQPF2U6KiCW0KQlSx88HWgAn52VGOblgGMrc5kZH HqdPSk8SVHumTUW7zNvfpELAeGuxXosQ52CxR0mhkkRJZ7Y++VGfgQpFG6hcmtwU vV8L9P4a+6+zbV3Ko7Ga6ccF+U0eiJ5XMoNcbHQ+ml19Q9rk8yBKtqplj+QfnXg= =p9lk -----END PGP SIGNATURE----- --MhFMjAhI8fRr5lpNNNXuQVRgPRfiBPK6E--