From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgzHK-0001oz-00 for qemu-devel@nongnu.org; Wed, 22 Oct 2014 13:00:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgzHE-0001MV-VQ for qemu-devel@nongnu.org; Wed, 22 Oct 2014 13:00:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgzHE-0001MD-Mx for qemu-devel@nongnu.org; Wed, 22 Oct 2014 13:00:48 -0400 Message-ID: <5447E2BB.7070508@redhat.com> Date: Wed, 22 Oct 2014 11:00:43 -0600 From: Eric Blake MIME-Version: 1.0 References: <1413993434-11816-1-git-send-email-mreitz@redhat.com> <1413993434-11816-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1413993434-11816-3-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Qq5aLuG2d1cQVQJ5oNa7S1K2JhqBoQsVv" Subject: Re: [Qemu-devel] [PATCH v3 2/3] raw-posix: raw_co_get_block_status() return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Qq5aLuG2d1cQVQJ5oNa7S1K2JhqBoQsVv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/22/2014 09:57 AM, Max Reitz wrote: > Instead of generating the full return value thrice in try_fiemap(), > try_seek_hole() and as a fall-back in raw_co_get_block_status() itself,= > generate the value only in raw_co_get_block_status(). >=20 > While at it, also remove the pnum parameter from try_fiemap() and > try_seek_hole(). >=20 > Suggested-by: Kevin Wolf > Signed-off-by: Max Reitz > --- > block/raw-posix.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) Reviewed-by: Eric Blake > - ret =3D try_seek_hole(bs, start, &data, &hole, pnum); > + ret =3D try_seek_hole(bs, start, &data, &hole); > if (ret < 0) { > - ret =3D try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);= > + ret =3D try_fiemap(bs, start, &data, &hole, nb_sectors); > if (ret < 0) { > /* Assume everything is allocated. */ > data =3D 0; > hole =3D start + nb_sectors * BDRV_SECTOR_SIZE; > - ret =3D BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | start;= > + ret =3D 0; > } > } > =20 > + assert(ret >=3D 0); I'm not sure the assertion adds much (the lines above are fairly easy to reason about ret always being set), but it does protect against later code addition, so I'm not opposed to leaving it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Qq5aLuG2d1cQVQJ5oNa7S1K2JhqBoQsVv 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 iQEcBAEBCAAGBQJUR+K7AAoJEKeha0olJ0Nq99MIAKONqQgElPPBOAO7GOhyVXPV DBO+GzCXJtOz9sX/w7vsuFX6YmZ3d4rbKAayCc3nKALBAQ07OqeLsrahwdEe0SGJ 8eNAEW70A0157wLvndgip0BSlLiEcRmyJYxuJpHGfTjuj6uMayrH/6L21IKZMAiN IDhmxkDpv3jqPkA08/O8ucaHMJBzN94GJvaWZGwoU1Bh04mqHy0WBpqaPFwcoRX/ MKrMGTfYuXvOY9rch69g7MJ/VTGPeYKVENd/iUdVnHo7hAf0zSmkk9eOAdnniSTt 0cVznOv9bS2DILiNeOa5Ya+RI+iWSX94kj9Lk9kJw9SmAotDvWpLGzUncwf/0G8= =mAs4 -----END PGP SIGNATURE----- --Qq5aLuG2d1cQVQJ5oNa7S1K2JhqBoQsVv--