From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2qS0-00081F-Bk for qemu-devel@nongnu.org; Tue, 17 May 2016 21:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2li7-0007aK-GO for qemu-devel@nongnu.org; Tue, 17 May 2016 16:35:24 -0400 References: <1463503863-19009-1-git-send-email-kwolf@redhat.com> <1463503863-19009-4-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <573B8085.4010706@redhat.com> Date: Tue, 17 May 2016 14:35:17 -0600 MIME-Version: 1.0 In-Reply-To: <1463503863-19009-4-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JCNv3J5u5q1W1WHLSGwS0xSbrkC3n2hJS" Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-iotests: Some more write_zeroes tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, den@openvz.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JCNv3J5u5q1W1WHLSGwS0xSbrkC3n2hJS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/17/2016 10:51 AM, Kevin Wolf wrote: > This covers some more write_zeroes cases which are relevant for the > recent qcow2 optimisations that check the allocation status of the > backing file for partial cluster write_zeroes requests. >=20 > Signed-off-by: Kevin Wolf > --- > +# qcow2 specific bdrv_write_zeroes tests with backing files (complemen= ts 034) > +_supported_fmt qcow2 I guess test 034 covered cases of larger-than-sector write_zero, and that the reason you needed a new test id is because this one is qcow2 specific (the general test covers multiple formats, but the behavior on sub-cluster zeroing is specific to qcow2). Makes sense so far. > + > +CLUSTER_SIZE=3D4k > +size=3D128M > + > +echo > +echo =3D=3D backing file contains zeros =3D=3D > + > +# Make sure that the whole cluster is allocated even for partial write= _zeroes > +# when the backing file contains zeros > + > +CLUSTER_SIZE=3D512 TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size > +_make_test_img -b "$TEST_IMG.base" > + > +$QEMU_IO -c "write -z 0k 2k" "$TEST_IMG" | _filter_qemu_io head aligned, tail is unaligned > +$QEMU_IO -c "write -z 10k 2k" "$TEST_IMG" | _filter_qemu_io head is unaligned, tail is unaligned > +$QEMU_IO -c "write -z 17k 2k" "$TEST_IMG" | _filter_qemu_io both unaligned, and completely contained within a single cluster No test of crossing a cluster boundary at this point? I would probably d= o: $QEMU_IO -c "write -z 27k 2k" "$TEST_IMG" | _filter_qemu_io then check that the map shows an allocation starting at 24k for 8192 byte= s > +$QEMU_IMG map --output=3Djson "$TEST_IMG" | _filter_qemu_img_map > + > +echo > +echo =3D=3D backing file contains non-zero data before write_zeros =3D= =3D > + > +CLUSTER_SIZE=3D512 TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size > +_make_test_img -b "$TEST_IMG.base" > + > +$QEMU_IO -c "write -P 0x11 32k 1k" "$TEST_IMG.base" | _filter_qemu_io > +$QEMU_IO -c "write -z 34k 1k" "$TEST_IMG" | _filter_qemu_io cluster contains partial non-zero data, which does not overlap with the write zero request. Good - you're testing that we don't nuke the rest of the cluster (that is, we cannot convert an entire cluster to 0 unless all sectors read as 0 before the conversion), but instead do proper copy-on-write. > +$QEMU_IO -c "read -P 0x11 32k 1k" "$TEST_IMG" | _filter_qemu_io > +$QEMU_IO -c "read -P 0 33k 3k" "$TEST_IMG" | _filter_qemu_io > +$QEMU_IMG map --output=3Djson "$TEST_IMG" | _filter_qemu_img_map > + > +echo > +echo =3D=3D backing file contains non-zero data after write_zeros =3D=3D= > + > +CLUSTER_SIZE=3D512 TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size > +_make_test_img -b "$TEST_IMG.base" > + > +$QEMU_IO -c "write -P 0x11 43k 1k" "$TEST_IMG.base" | _filter_qemu_io > +$QEMU_IO -c "write -z 41k 1k" "$TEST_IMG" | _filter_qemu_io > +$QEMU_IO -c "read -P 0x11 43k 1k" "$TEST_IMG" | _filter_qemu_io > +$QEMU_IO -c "read -P 0 40k 3k" "$TEST_IMG" | _filter_qemu_io > +$QEMU_IMG map --output=3Djson "$TEST_IMG" | _filter_qemu_img_map > + > +echo > +echo =3D=3D spanning multiple clusters =3D=3D > + > +CLUSTER_SIZE=3D512 TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size > +_make_test_img -b "$TEST_IMG.base" > + > +$QEMU_IO -c "write -P 0x11 74k 2k" "$TEST_IMG.base" | _filter_qemu_io > +$QEMU_IO -c "write -z 66k 7k" "$TEST_IMG" | _filter_qemu_io the tail from 72k to 73k overlaps the sector that has to be copy-on-write to pick up the data at 74k; while the earlier portion picks up the clusters at 64k and 68k. Looks good. What you have looks fine, but again, I'd consider also testing a sub-cluster size 'write -z' that spans a cluster boundary, including the case where it is overwriting data from the backing file. Something like:= $QEMU_IO -c "write -P 0x11 2k 4k" "$TEST_IMG.base" | _filter_qemu_io $QEMU_IO -c "write -z 3k 2k" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -P 0 0k 2k" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -P 0x11 2k 1k" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -P 0 3k 2k" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -P 0x11 5k 1k" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -P 0 6k 2k" "$TEST_IMG" | _filter_qemu_io --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --JCNv3J5u5q1W1WHLSGwS0xSbrkC3n2hJS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXO4CFAAoJEKeha0olJ0NqySUH/3fmPnUTaV5rLVL+aM1eVUPb JKB7NSF+MRDYAe/xldSwxUbTFMTF1rsN6T4GiVsk5uW6VPQVZ5qFnlIyGL/QBai9 praLW3z0fCNHa6oksmu3DLfQF7jOD7G6v8Anuor+L1tMqoCRhe+RSwPgC0CqzGNk 01fKhZYgpr2KOt2FvtVblzzVTep+gUIaRzn2M2N4ifansV+XqPj7XOU7jkVBVvr/ KIH2Cwp1tPQnhtLZxnU3m8qvvVBAiU3YV5EqBlwUrlgx3nig2mqf2tADgloOg8Qy Lc9km4ZpDG+S/UR0xKJB8caQmMpfjLnGTFwohBre254xzLtxGBGEwz0Dfvbn6Ik= =YRq3 -----END PGP SIGNATURE----- --JCNv3J5u5q1W1WHLSGwS0xSbrkC3n2hJS--