From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz1SO-00026h-5R for qemu-devel@nongnu.org; Thu, 11 Dec 2014 05:59:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz1SF-0001sd-3Q for qemu-devel@nongnu.org; Thu, 11 Dec 2014 05:58:52 -0500 Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:60728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz1SE-0001sZ-Rw for qemu-devel@nongnu.org; Thu, 11 Dec 2014 05:58:43 -0500 Received: by mail-wg0-f45.google.com with SMTP id b13so6113183wgh.18 for ; Thu, 11 Dec 2014 02:58:42 -0800 (PST) Date: Thu, 11 Dec 2014 10:58:39 +0000 From: Stefan Hajnoczi Message-ID: <20141211105839.GE30812@stefanha-thinkpad.redhat.com> References: <1417613866-25890-1-git-send-email-mreitz@redhat.com> <1417613866-25890-6-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ep0oHQY+/Gbo/zt0" Content-Disposition: inline In-Reply-To: <1417613866-25890-6-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 05/26] qcow2: Use unsigned addend for update_refcount() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi --ep0oHQY+/Gbo/zt0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 03, 2014 at 02:37:25PM +0100, Max Reitz wrote: > @@ -530,8 +530,16 @@ found: > } > =20 > /* XXX: cache several refcount block clusters ? */ > +/* In order to decrease refcounts, set @addend to the two's complement (= giving a > + * negative value and letting the implicit cast handle it is enough) and= set > + * @decrease to true. @decrease must be false if the refcount should be > + * increased. */ The first time I read this patch I missed this quirk and thought that a lot of places seemed to be doing the wrong thing with addend. This is likely to cause confusion, why not make uint16_t addend truly unsigned and leave the sign to bool decrease, as suggested by the function prototype? --ep0oHQY+/Gbo/zt0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUiXjfAAoJEJykq7OBq3PI8vwH/3GfpxBeA2A1GEbN+kvIKtyx F7I+0Zm7DuzREp0zyEYVYXQhdfY9VKp7s4bZhJIjl7h5tXdkJWlEOgiew8ZCaAOb lNgBf3uB9Jvn0ZT8/71ZYaUxp6zNPrHv4tlpThqZCahYxJ+V7E8ROXdOfpc7n6nj 8ItJp1afmWnjDIW/ePeUkthz5Jci77qBn6bGJI4vug0rfMLOnVJWMVUS3yhlucup 9pfXwNf33iHhzWfqab4XvvLXDWyu71PxKQK51dSDz3Sh4AWg0Fw7azuciUT8hsZQ RvVbLiXPdLAKhjW/XJJtDG5oB4G3WNIhMtV96QYTyhDhgMifJNzTX+QwdXEOCFM= =D0ab -----END PGP SIGNATURE----- --ep0oHQY+/Gbo/zt0--