From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpegS-0003nb-Kj for qemu-devel@nongnu.org; Sat, 15 Nov 2014 09:50:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpegL-0006DO-GB for qemu-devel@nongnu.org; Sat, 15 Nov 2014 09:50:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpegL-0006D4-87 for qemu-devel@nongnu.org; Sat, 15 Nov 2014 09:50:33 -0500 Message-ID: <5467682E.1030604@redhat.com> Date: Sat, 15 Nov 2014 07:50:22 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415970374-16811-1-git-send-email-mreitz@redhat.com> <1415970374-16811-22-git-send-email-mreitz@redhat.com> In-Reply-To: <1415970374-16811-22-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xuXVT2qjWmOknMr8TQ604514ACunJCRiD" Subject: Re: [Qemu-devel] [PATCH v2 21/21] iotests: Add test for different refcount widths List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xuXVT2qjWmOknMr8TQ604514ACunJCRiD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/14/2014 06:06 AM, Max Reitz wrote: > Add a test for conversion between different refcount widths and errors > specific to certain widths (i.e. snapshots with refcount_width=3D1). >=20 > Signed-off-by: Max Reitz > --- > tests/qemu-iotests/112 | 252 +++++++++++++++++++++++++++++++++++++= ++++++++ > tests/qemu-iotests/112.out | 131 +++++++++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 384 insertions(+) > create mode 100755 tests/qemu-iotests/112 > create mode 100644 tests/qemu-iotests/112.out >=20 > +echo > +echo '=3D=3D=3D Testing too many references for check =3D=3D=3D' > +echo > + > +IMGOPTS=3D"$IMGOPTS,refcount_width=3D1" _make_test_img 64M > +print_refcount_width > + > +# This cluster should be created at 0x50000 > +$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io > +# Now make the second L2 entry (the L2 table should be at 0x40000) poi= nt to that > +# cluster, so we have two references > +poke_file "$TEST_IMG" $((0x40008)) "\x80\x00\x00\x00\x00\x05\x00\x00" > + > +# This should say "please use amend" > +_check_test_img -r all > + > +# So we do that > +$QEMU_IMG amend -o refcount_width=3D2 "$TEST_IMG" > +print_refcount_width > + > +# And try again > +_check_test_img -r all I think this section also deserves a test that fuzzes an image with width=3D64 to intentionally set the most significant bit of one of the refcounts, and make sure that we gracefully diagnose it as invalid. > + > +echo > +echo '=3D=3D=3D Multiple walks necessary during amend =3D=3D=3D' > +echo > + > +IMGOPTS=3D"$IMGOPTS,refcount_width=3D1,cluster_size=3D512" _make_test_= img 64k > + > +# Cluster 0 is the image header, clusters 1 to 4 are used by the L1 ta= ble, a > +# single L2 table, the reftable and a single refblock. This creates 58= data > +# clusters (actually, the L2 table is created here, too), so in total = there are > +# then 63 used clusters in the image. With a refcount width of 64, one= refblock > +# describes 64 clusters (512 bytes / 64 bits/entry =3D 64 entries), so= this will > +# make the first target refblock have exactly one free entry. > +$QEMU_IO -c "write 0 $((58 * 512))" "$TEST_IMG" | _filter_qemu_io > + > +# Now change the refcount width; since the first target refblock has e= xactly one > +# free entry, that entry will be used to store its own reference. No o= ther > +# refblocks are needed, so then the new reftable will be allocated; si= nce the > +# first target refblock is completely filled up, this will require a n= ew > +# refblock which is why the refcount width changing function will need= to run > +# through everything one more time until the allocations are stable. > +$QEMU_IMG amend -o refcount_width=3D64 "$TEST_IMG" > +print_refcount_width Umm, that sounds backwards from what you document. It's a good test of the _new_ reftable needing a second round of allocations. So keep it with corrected comments. But I think you _intended_ to write a test that starts with a refcount_width=3D64 image and resize to a refcount_width=3D1, where the _old_ reftable then suffers a reallocation as part of allocating refblocks for the new table. It may even help if you add a tracepoint for every iteration through the walk function callback, to prove we are indeed executing it 3 times instead of the usual 2, for these test cases. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xuXVT2qjWmOknMr8TQ604514ACunJCRiD 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 iQEcBAEBCAAGBQJUZ2guAAoJEKeha0olJ0NqZJEH/iJ4kisC2qrkJNdlRZuo2Tpu urG3Y4WXe2szVqpHRU+PfjCgCxWYXCyTbCBYFQtYbVKgJQUoIGHn1jH8ERizOyMF E2nMV6hgCLwCqgShiEKOd6bqREeZO1jIjAksfnxrhJO971bXeRcA+vosXGKoOOj4 t8CuzHxMLsOvcsAc/z5X7xK00SU/C97DNZ+TEbp+p///6aBWkY5y74+iAvQTX9J4 Qnvfcc1ELL1Hps8UIME3iKVwAVlDxtQaPGRANT7FehshkNb5at0W6ZNxU2cfq6h1 pNmTu3adia33oJcqvaUo1e8wXz2XVH/f2ziMTNQ3Y513/Z1ELYvhyONQNCPdRTU= =3e6B -----END PGP SIGNATURE----- --xuXVT2qjWmOknMr8TQ604514ACunJCRiD--