From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJksM-0000w9-Ba for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:31:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJksI-0008WU-AC for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:31:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJksI-0008WI-2V for qemu-devel@nongnu.org; Fri, 06 Feb 2015 10:31:18 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t16FVGEA029614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 6 Feb 2015 10:31:17 -0500 Message-ID: <54D4DE43.7050207@redhat.com> Date: Fri, 06 Feb 2015 08:31:15 -0700 From: Eric Blake MIME-Version: 1.0 References: <1423233556-19394-1-git-send-email-mreitz@redhat.com> <54D4DD45.5010809@redhat.com> In-Reply-To: <54D4DD45.5010809@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MrL0OoBtXKOmDoGDOERxKBDGLSON6GU30" Subject: Re: [Qemu-devel] [PATCH v3] qcow2: Rewrite qcow2_alloc_bytes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --MrL0OoBtXKOmDoGDOERxKBDGLSON6GU30 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/06/2015 08:27 AM, Eric Blake wrote: >> =20 >> - /* The cluster refcount was incremented, either by qcow2_alloc_cl= usters() >> - * or explicitly by qcow2_update_cluster_refcount(). Refcount bl= ocks must >> - * be flushed before the caller's L2 table updates. >> - */ >> + assert(offset); >> + ret =3D update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER)= ; >=20 > Case 1: This incremented the new cluster. Good > Case 2: This incremented the old cluster. Good > Case 3: This incremented the new cluster. Good > Case 4: This incremented the old cluster. But the new cluster remains a= t > refcount 0. BAD. Wait. Maybe I'm confused. You are requesting an update_refcount() across size bytes, and given the offset, that means that the code will round up to cover BOTH clusters in one call. Does update_refcount() properly increment from [ 1, 0 ] to [ 2, 1 ] when given a 2-cluster size (when offset, size is rounded up to cluster boundaries)? If so, then there is no bug after all. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --MrL0OoBtXKOmDoGDOERxKBDGLSON6GU30 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/ iQEcBAEBCAAGBQJU1N5DAAoJEKeha0olJ0Nqbe0H/R7AW+xanbgRkLB6LK7w0SYL RIQ8Z0UsWnvN/TNTROXnCOaOy47ZutZeaYvcTJpY9o+pZOgC0UH+SfEx+LUTwZnT YaNU/KxuRyxgKZWXOk7HEb4w/mQr+g0z9QS8QY1APC02NgtkroFKSUlTcgVS9wTR n5y4uVtb0q/+cbIb/9NiXGzDdW3TTll2xnFfzM3BeWUJjsJZ+DCGkU3GJh3Hvt7F vKNm0pBaceGObgNn25h0Dm5H6FMBYKDAx+XLrpf13sh6N3JNYQxsW0/S3Gl3wTXG CyqpHhUzLZ8ao5xPQ7Infk2ofQwAv0w4EHeGyvW+pd7g4vqut1Io0jHItqg1giA= =WEMY -----END PGP SIGNATURE----- --MrL0OoBtXKOmDoGDOERxKBDGLSON6GU30--