From nobody Mon May 6 23:14:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490913593546518.2600805866807; Thu, 30 Mar 2017 15:39:53 -0700 (PDT) Received: from localhost ([::1]:37967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctijQ-0000aj-5O for importer@patchew.org; Thu, 30 Mar 2017 18:39:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctige-00079w-9q for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctigb-0000rS-8l for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:37:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctigU-0000o1-4k; Thu, 30 Mar 2017 18:36:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BECC81243; Thu, 30 Mar 2017 22:36:49 +0000 (UTC) Received: from red.redhat.com (ovpn-122-200.rdu2.redhat.com [10.10.122.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30C8F77DEA; Thu, 30 Mar 2017 22:36:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2BECC81243 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2BECC81243 From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 30 Mar 2017 17:36:43 -0500 Message-Id: <20170330223645.349-2-eblake@redhat.com> In-Reply-To: <20170330223645.349-1-eblake@redhat.com> References: <20170330223645.349-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Mar 2017 22:36:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 1/3] iotests: fix 097 when run with qcow X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The previous commit: commit a3e1505daec31ef56f0489f8c8fff1b8e4ca92bd Author: Eric Blake Date: Mon Dec 5 09:49:34 2016 -0600 qcow2: Don't strand clusters near 2G intervals during commit extended the 097 test case so that it did two passes, once with an internal snapshot, once without. qcow (v1) does not support internal snapshots, so this change broke test 097 when run against qcow. This splits 097 in two, creating a new 176 that tests the internal snapshot codepath, effectively putting 097 back to its content before the above commit. Reviewed-by: Max Reitz Signed-off-by: Daniel P. Berrange Message-Id: <20170221115512.21918-8-berrange@redhat.com> [eblake: test collisions: s/173/176/g] Signed-off-by: Eric Blake --- tests/qemu-iotests/097 | 10 +--- tests/qemu-iotests/097.out | 125 ++---------------------------------------= --- tests/qemu-iotests/176 | 126 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/176.out | 119 ++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 5 files changed, 251 insertions(+), 130 deletions(-) create mode 100755 tests/qemu-iotests/176 create mode 100644 tests/qemu-iotests/176.out diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097 index 4c33e80..1d28aff 100755 --- a/tests/qemu-iotests/097 +++ b/tests/qemu-iotests/097 @@ -56,26 +56,19 @@ _supported_os Linux # 3: Two-layer backing chain, commit to lower backing file # (in this case, the top image will implicitly stay unchanged) # -# Each pass is run twice, since qcow2 has different code paths for cleaning -# an image depending on whether it has a snapshot. -# # 020 already tests committing, so this only tests whether image chains are # working properly and that all images above the base are emptied; therefo= re, # no complicated patterns are necessary. Check near the 2G mark, as qcow2 # has been buggy at that boundary in the past. for i in 0 1 2 3; do -for j in 0 1; do echo -echo "=3D=3D=3D Test pass $i.$j =3D=3D=3D" +echo "=3D=3D=3D Test pass $i =3D=3D=3D" echo TEST_IMG=3D"$TEST_IMG.base" _make_test_img 2100M TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" 2100M _make_test_img -b "$TEST_IMG.itmd" 2100M -if [ $j -eq 0 ]; then - $QEMU_IMG snapshot -c snap "$TEST_IMG" -fi $QEMU_IO -c 'write -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qemu_io $QEMU_IO -c 'write -P 2 0x7ffe0000 128k' "$TEST_IMG.itmd" | _filter_qemu_io @@ -121,7 +114,6 @@ $QEMU_IMG map "$TEST_IMG.itmd" | _filter_qemu_img_map $QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map done -done # success, all done diff --git a/tests/qemu-iotests/097.out b/tests/qemu-iotests/097.out index 8106cc9..81fc225 100644 --- a/tests/qemu-iotests/097.out +++ b/tests/qemu-iotests/097.out @@ -1,6 +1,6 @@ QA output created by 097 -=3D=3D=3D Test pass 0.0 =3D=3D=3D +=3D=3D=3D Test pass 0 =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base @@ -29,66 +29,7 @@ Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -=3D=3D=3D Test pass 0.1 =3D=3D=3D - -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd -wrote 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 131072/131072 bytes at offset 2147352576 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Image committed. -read 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147287040 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147352576 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Offset Length File -0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd - -=3D=3D=3D Test pass 1.0 =3D=3D=3D - -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd -wrote 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 131072/131072 bytes at offset 2147352576 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Image committed. -read 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147287040 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147352576 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Offset Length File -0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd -0x7fff0000 0x10000 TEST_DIR/t.IMGFMT - -=3D=3D=3D Test pass 1.1 =3D=3D=3D +=3D=3D=3D Test pass 1 =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base @@ -118,7 +59,7 @@ Offset Length File 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT -=3D=3D=3D Test pass 2.0 =3D=3D=3D +=3D=3D=3D Test pass 2 =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base @@ -148,65 +89,7 @@ Offset Length File 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT -=3D=3D=3D Test pass 2.1 =3D=3D=3D - -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd -wrote 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 131072/131072 bytes at offset 2147352576 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Image committed. -read 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147287040 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147352576 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Offset Length File -0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd -0x7fff0000 0x10000 TEST_DIR/t.IMGFMT - -=3D=3D=3D Test pass 3.0 =3D=3D=3D - -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd -wrote 196608/196608 bytes at offset 2147287040 -192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 131072/131072 bytes at offset 2147352576 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Image committed. -read 65536/65536 bytes at offset 2147287040 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147352576 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65536/65536 bytes at offset 2147418112 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Offset Length File -0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -Offset Length File -0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base -0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd -0x7fff0000 0x10000 TEST_DIR/t.IMGFMT - -=3D=3D=3D Test pass 3.1 =3D=3D=3D +=3D=3D=3D Test pass 3 =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176 new file mode 100755 index 0000000..9a70a87 --- /dev/null +++ b/tests/qemu-iotests/176 @@ -0,0 +1,126 @@ +#!/bin/bash +# +# Commit changes into backing chains and empty the top image if the +# backing image is not explicitly specified. +# +# Variant of 097, which includes snapshots to test different codepath +# in qcow2 +# +# Copyright (C) 2014 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dmreitz@redhat.com + +seq=3D"$(basename $0)" +echo "QA output created by $seq" + +here=3D"$PWD" +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + _rm_test_img "$TEST_IMG.itmd" +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +# Any format supporting backing files and bdrv_make_empty +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + + +# Four passes: +# 0: Two-layer backing chain, commit to upper backing file (implicitly) +# (in this case, the top image will be emptied) +# 1: Two-layer backing chain, commit to upper backing file (explicitly) +# (in this case, the top image will implicitly stay unchanged) +# 2: Two-layer backing chain, commit to upper backing file (implicitly wi= th -d) +# (in this case, the top image will explicitly stay unchanged) +# 3: Two-layer backing chain, commit to lower backing file +# (in this case, the top image will implicitly stay unchanged) +# +# 020 already tests committing, so this only tests whether image chains are +# working properly and that all images above the base are emptied; therefo= re, +# no complicated patterns are necessary. Check near the 2G mark, as qcow2 +# has been buggy at that boundary in the past. +for i in 0 1 2 3; do + +echo +echo "=3D=3D=3D Test pass $i =3D=3D=3D" +echo + +TEST_IMG=3D"$TEST_IMG.base" _make_test_img 2100M +TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" 2100M +_make_test_img -b "$TEST_IMG.itmd" 2100M +$QEMU_IMG snapshot -c snap "$TEST_IMG" + +$QEMU_IO -c 'write -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qemu_io +$QEMU_IO -c 'write -P 2 0x7ffe0000 128k' "$TEST_IMG.itmd" | _filter_qemu_io +$QEMU_IO -c 'write -P 3 0x7fff0000 64k' "$TEST_IMG" | _filter_qemu_io + +if [ $i -lt 3 ]; then + if [ $i =3D=3D 0 ]; then + # -b "$TEST_IMG.itmd" should be the default (that is, committing t= o the + # first backing file in the chain) + $QEMU_IMG commit "$TEST_IMG" + elif [ $i =3D=3D 1 ]; then + # explicitly specify the commit target (this should imply -d) + $QEMU_IMG commit -b "$TEST_IMG.itmd" "$TEST_IMG" + else + # do not explicitly specify the commit target, but use -d to leave= the + # top image unchanged + $QEMU_IMG commit -d "$TEST_IMG" + fi + + # Bottom should be unchanged + $QEMU_IO -c 'read -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qem= u_io + + # Intermediate should contain changes from top + $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io + $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io + $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io + + # And in pass 0, the top image should be empty, whereas in both other = passes + # it should be unchanged (which is both checked by qemu-img map) +else + $QEMU_IMG commit -b "$TEST_IMG.base" "$TEST_IMG" + + # Bottom should contain all changes + $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.base" | _filter_qemu= _io + $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.base" | _filter_qemu= _io + $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.base" | _filter_qemu= _io + + # Both top and intermediate should be unchanged +fi + +$QEMU_IMG map "$TEST_IMG.base" | _filter_qemu_img_map +$QEMU_IMG map "$TEST_IMG.itmd" | _filter_qemu_img_map +$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map + +done + + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out new file mode 100644 index 0000000..fc63653 --- /dev/null +++ b/tests/qemu-iotests/176.out @@ -0,0 +1,119 @@ +QA output created by 176 + +=3D=3D=3D Test pass 0 =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +wrote 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 2147352576 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Image committed. +read 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147287040 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147352576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length File +0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd + +=3D=3D=3D Test pass 1 =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +wrote 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 2147352576 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Image committed. +read 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147287040 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147352576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length File +0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd +0x7fff0000 0x10000 TEST_DIR/t.IMGFMT + +=3D=3D=3D Test pass 2 =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +wrote 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 2147352576 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Image committed. +read 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147287040 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147352576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length File +0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd +0x7fff0000 0x10000 TEST_DIR/t.IMGFMT + +=3D=3D=3D Test pass 3 =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +wrote 196608/196608 bytes at offset 2147287040 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 2147352576 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Image committed. +read 65536/65536 bytes at offset 2147287040 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147352576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2147418112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Offset Length File +0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +Offset Length File +0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base +0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd +0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 1f4bf03..43142dd 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -168,3 +168,4 @@ 173 rw auto 174 auto 175 auto quick +176 rw auto backing --=20 2.9.3 From nobody Mon May 6 23:14:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490913518230486.2424348655579; Thu, 30 Mar 2017 15:38:38 -0700 (PDT) Received: from localhost ([::1]:37962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctiiC-00089T-N1 for importer@patchew.org; Thu, 30 Mar 2017 18:38:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctige-0007A0-CR for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctigb-0000rY-Id for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:37:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60392) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctigV-0000oi-Dz; Thu, 30 Mar 2017 18:36:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E7066AAF1; Thu, 30 Mar 2017 22:36:50 +0000 (UTC) Received: from red.redhat.com (ovpn-122-200.rdu2.redhat.com [10.10.122.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6488477DEA; Thu, 30 Mar 2017 22:36:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6E7066AAF1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6E7066AAF1 From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 30 Mar 2017 17:36:44 -0500 Message-Id: <20170330223645.349-3-eblake@redhat.com> In-Reply-To: <20170330223645.349-1-eblake@redhat.com> References: <20170330223645.349-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Mar 2017 22:36:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 2/3] iotests: Improve image-clear tests on non-aligned image X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Tweak 097 and 176 to operate on an image that is not cluster-aligned, to give further coverage of clearing out an entire image. Tested for qcow (97) and qcow2 (97 and 176). The fact that there is a subtle difference between the expected outputs of 97 and 176 on pass 0 is evidence that we still don't always clear out the full image in qcow2. Commit a3e1505 fixed the case of clusters stranded at the 2G mark, but did not fix stranding an unaligned tail. That will be the next patch, kept separate to make it easier to see the impact. Signed-off-by: Eric Blake --- v7: also write data in the unaligned cluster, and document bug it exposes v6: new patch --- tests/qemu-iotests/097 | 17 +++++++++----- tests/qemu-iotests/097.out | 55 ++++++++++++++++++++++++++++++++++++------= ---- tests/qemu-iotests/176 | 17 +++++++++----- tests/qemu-iotests/176.out | 55 ++++++++++++++++++++++++++++++++++++------= ---- 4 files changed, 108 insertions(+), 36 deletions(-) diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097 index 1d28aff..e22670c 100755 --- a/tests/qemu-iotests/097 +++ b/tests/qemu-iotests/097 @@ -66,13 +66,15 @@ echo echo "=3D=3D=3D Test pass $i =3D=3D=3D" echo -TEST_IMG=3D"$TEST_IMG.base" _make_test_img 2100M -TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" 2100M -_make_test_img -b "$TEST_IMG.itmd" 2100M +len=3D$((2100 * 1024 * 1024 + 512)) # larger than 2G, and not cluster alig= ned +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $len +TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" $len +_make_test_img -b "$TEST_IMG.itmd" $len -$QEMU_IO -c 'write -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qemu_io -$QEMU_IO -c 'write -P 2 0x7ffe0000 128k' "$TEST_IMG.itmd" | _filter_qemu_io -$QEMU_IO -c 'write -P 3 0x7fff0000 64k' "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -c "write -P 1 0x7ffd0000 192k" "$TEST_IMG.base" | _filter_qemu_io +$QEMU_IO -c "write -P 2 0x7ffe0000 128k" "$TEST_IMG.itmd" | _filter_qemu_io +$QEMU_IO -c "write -P 3 0x7fff0000 64k" "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -c "write -P 4 $(($len - 512)) 512" "$TEST_IMG" | _filter_qemu_io if [ $i -lt 3 ]; then if [ $i =3D=3D 0 ]; then @@ -90,11 +92,13 @@ if [ $i -lt 3 ]; then # Bottom should be unchanged $QEMU_IO -c 'read -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qem= u_io + $QEMU_IO -c "read -P 0 $((len - 512)) 512" "$TEST_IMG.base" | _filter_= qemu_io # Intermediate should contain changes from top $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io + $QEMU_IO -c "read -P 4 $((len - 512)) 512" "$TEST_IMG.itmd" | _filter_= qemu_io # And in pass 0, the top image should be empty, whereas in both other = passes # it should be unchanged (which is both checked by qemu-img map) @@ -105,6 +109,7 @@ else $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.base" | _filter_qemu= _io $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.base" | _filter_qemu= _io $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.base" | _filter_qemu= _io + $QEMU_IO -c "read -P 4 $((len - 512)) 512" "$TEST_IMG.base" | _filter_= qemu_io # Both top and intermediate should be unchanged fi diff --git a/tests/qemu-iotests/097.out b/tests/qemu-iotests/097.out index 81fc225..f6705a1 100644 --- a/tests/qemu-iotests/097.out +++ b/tests/qemu-iotests/097.out @@ -2,104 +2,130 @@ QA output created by 097 =3D=3D=3D Test pass 0 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd =3D=3D=3D Test pass 1 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT =3D=3D=3D Test pass 2 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT =3D=3D=3D Test pass 3 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -107,13 +133,18 @@ read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +0x83400000 0x200 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT *** done diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176 index 9a70a87..950b287 100755 --- a/tests/qemu-iotests/176 +++ b/tests/qemu-iotests/176 @@ -69,14 +69,16 @@ echo echo "=3D=3D=3D Test pass $i =3D=3D=3D" echo -TEST_IMG=3D"$TEST_IMG.base" _make_test_img 2100M -TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" 2100M -_make_test_img -b "$TEST_IMG.itmd" 2100M +len=3D$((2100 * 1024 * 1024 + 512)) # larger than 2G, and not cluster alig= ned +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $len +TEST_IMG=3D"$TEST_IMG.itmd" _make_test_img -b "$TEST_IMG.base" $len +_make_test_img -b "$TEST_IMG.itmd" $len $QEMU_IMG snapshot -c snap "$TEST_IMG" -$QEMU_IO -c 'write -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qemu_io -$QEMU_IO -c 'write -P 2 0x7ffe0000 128k' "$TEST_IMG.itmd" | _filter_qemu_io -$QEMU_IO -c 'write -P 3 0x7fff0000 64k' "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -c "write -P 1 0x7ffd0000 192k" "$TEST_IMG.base" | _filter_qemu_io +$QEMU_IO -c "write -P 2 0x7ffe0000 128k" "$TEST_IMG.itmd" | _filter_qemu_io +$QEMU_IO -c "write -P 3 0x7fff0000 64k" "$TEST_IMG" | _filter_qemu_io +$QEMU_IO -c "write -P 4 $(($len - 512)) 512" "$TEST_IMG" | _filter_qemu_io if [ $i -lt 3 ]; then if [ $i =3D=3D 0 ]; then @@ -94,11 +96,13 @@ if [ $i -lt 3 ]; then # Bottom should be unchanged $QEMU_IO -c 'read -P 1 0x7ffd0000 192k' "$TEST_IMG.base" | _filter_qem= u_io + $QEMU_IO -c "read -P 0 $((len - 512)) 512" "$TEST_IMG.base" | _filter_= qemu_io # Intermediate should contain changes from top $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.itmd" | _filter_qemu= _io + $QEMU_IO -c "read -P 4 $((len - 512)) 512" "$TEST_IMG.itmd" | _filter_= qemu_io # And in pass 0, the top image should be empty, whereas in both other = passes # it should be unchanged (which is both checked by qemu-img map) @@ -109,6 +113,7 @@ else $QEMU_IO -c 'read -P 1 0x7ffd0000 64k' "$TEST_IMG.base" | _filter_qemu= _io $QEMU_IO -c 'read -P 2 0x7ffe0000 64k' "$TEST_IMG.base" | _filter_qemu= _io $QEMU_IO -c 'read -P 3 0x7fff0000 64k' "$TEST_IMG.base" | _filter_qemu= _io + $QEMU_IO -c "read -P 4 $((len - 512)) 512" "$TEST_IMG.base" | _filter_= qemu_io # Both top and intermediate should be unchanged fi diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out index fc63653..990a41c 100644 --- a/tests/qemu-iotests/176.out +++ b/tests/qemu-iotests/176.out @@ -2,104 +2,130 @@ QA output created by 176 =3D=3D=3D Test pass 0 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT =3D=3D=3D Test pass 1 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT =3D=3D=3D Test pass 2 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT =3D=3D=3D Test pass 3 =3D=3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202009600 -Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202009600 backin= g_file=3DTEST_DIR/t.IMGFMT.base -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D2202010112 +Formatting 'TEST_DIR/t.IMGFMT.itmd', fmt=3DIMGFMT size=3D2202010112 backin= g_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202010112 backing_fil= e=3DTEST_DIR/t.IMGFMT.itmd wrote 196608/196608 bytes at offset 2147287040 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 131072/131072 bytes at offset 2147352576 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Image committed. read 65536/65536 bytes at offset 2147287040 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -107,13 +133,18 @@ read 65536/65536 bytes at offset 2147352576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 2147418112 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 512/512 bytes at offset 2202009600 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Offset Length File 0x7ffd0000 0x30000 TEST_DIR/t.IMGFMT.base +0x83400000 0x200 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd +0x83400000 0x200 TEST_DIR/t.IMGFMT.base Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x10000 TEST_DIR/t.IMGFMT.itmd 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT *** done --=20 2.9.3 From nobody Mon May 6 23:14:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14909135092911004.6323816819574; Thu, 30 Mar 2017 15:38:29 -0700 (PDT) Received: from localhost ([::1]:37961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctihz-00081e-Mh for importer@patchew.org; Thu, 30 Mar 2017 18:38:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctigZ-00073t-Rz for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:36:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctigY-0000qn-RS for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:36:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45724) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctigW-0000p2-C0; Thu, 30 Mar 2017 18:36:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66B144E4CD; Thu, 30 Mar 2017 22:36:51 +0000 (UTC) Received: from red.redhat.com (ovpn-122-200.rdu2.redhat.com [10.10.122.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id A649C77DEA; Thu, 30 Mar 2017 22:36:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 66B144E4CD Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 66B144E4CD From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 30 Mar 2017 17:36:45 -0500 Message-Id: <20170330223645.349-4-eblake@redhat.com> In-Reply-To: <20170330223645.349-1-eblake@redhat.com> References: <20170330223645.349-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Mar 2017 22:36:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 3/3] qcow2: Discard unaligned tail when wiping image X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The previous commit pointed out a subtle difference between the fast and slow path of qcow2_make_empty(), where we failed to discard the final (partial) cluster of an unaligned image. The problem stems from the fact that qcow2_discard_clusters() was silently ignoring sub-cluster head and tail on unaligned requests. A quick audit of all callers shows that qcow2_snapshot_create() has always passed a cluster-aligned request since the call was added in commit 1ebf561; qcow2_co_pdiscard() has passed a cluster-aligned request since commit ecdbead taught the block layer about preferred discard alignment; and qcow2_make_empty() was fixed to pass an aligned start (but not necessarily end) in commit a3e1505. Asserting that the start is always aligned also points out that we now have a dead check: rounding the end offset down can never result in a value less than the aligned start offset (the check was rendered dead with commit ecdbead). Meanwhile, we do not want to round the end cluster down in the one case of the end offset matching the (unaligned) file size - that final partial cluster should still be discarded. With those fixes in place, we can adjust the testsuite so that qemu-iotests 97 and 176 are once again identical for qcow2, showing that fast and slow paths are back in sync. Signed-off-by: Eric Blake Reviewed-by: Max Reitz --- v7: new patch --- block/qcow2-cluster.c | 10 ++++------ tests/qemu-iotests/176.out | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 78c11d4..100398c 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1519,12 +1519,10 @@ int qcow2_discard_clusters(BlockDriverState *bs, ui= nt64_t offset, end_offset =3D offset + (nb_sectors << BDRV_SECTOR_BITS); - /* Round start up and end down */ - offset =3D align_offset(offset, s->cluster_size); - end_offset =3D start_of_cluster(s, end_offset); - - if (offset > end_offset) { - return 0; + /* The caller must cluster-align start; round end down except at EOF */ + assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); + if (end_offset !=3D bs->total_sectors * BDRV_SECTOR_SIZE) { + end_offset =3D start_of_cluster(s, end_offset); } nb_clusters =3D size_to_clusters(s, end_offset - offset); diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out index 990a41c..6271fa7 100644 --- a/tests/qemu-iotests/176.out +++ b/tests/qemu-iotests/176.out @@ -35,7 +35,7 @@ Offset Length File Offset Length File 0x7ffd0000 0x10000 TEST_DIR/t.IMGFMT.base 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd -0x83400000 0x200 TEST_DIR/t.IMGFMT +0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd =3D=3D=3D Test pass 1 =3D=3D=3D --=20 2.9.3