From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Fam Zheng" <fam@euphon.net>, "Peter Xu" <peterx@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Leonardo Bras" <leobras@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"John Snow" <jsnow@redhat.com>, "Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Jeuk Kim" <jeuk20.kim@samsung.com>,
qemu-block@nongnu.org,
"Andrey Drobyshev" <andrey.drobyshev@virtuozzo.com>,
"Eric Blake" <eblake@redhat.com>,
"Denis V . Lunev" <den@openvz.org>
Subject: [PULL v2 8/8] tests/qemu-iotests/197: add testcase for CoR with subclusters
Date: Tue, 29 Aug 2023 13:21:22 -0400 [thread overview]
Message-ID: <20230829172122.303592-9-stefanha@redhat.com> (raw)
In-Reply-To: <20230829172122.303592-1-stefanha@redhat.com>
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Add testcase which checks that allocations during copy-on-read are
performed on the subcluster basis when subclusters are enabled in target
image.
This testcase also triggers the following assert with previous commit
not being applied, so we check that as well:
qemu-io: ../block/io.c:1236: bdrv_co_do_copy_on_readv: Assertion `skip_bytes < pnum' failed.
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230711172553.234055-4-andrey.drobyshev@virtuozzo.com>
---
tests/qemu-iotests/197 | 29 +++++++++++++++++++++++++++++
tests/qemu-iotests/197.out | 24 ++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index a2547bc280..f07a9da136 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -122,6 +122,35 @@ $QEMU_IO -f qcow2 -C -c 'read 0 1024' "$TEST_WRAP" | _filter_qemu_io
$QEMU_IO -f qcow2 -c map "$TEST_WRAP"
_check_test_img
+echo
+echo '=== Copy-on-read with subclusters ==='
+echo
+
+# Create base and top images 64K (1 cluster) each. Make subclusters enabled
+# for the top image
+_make_test_img 64K
+IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
+ _make_test_img --no-opts -o extended_l2=true -F "$IMGFMT" -b "$TEST_IMG" \
+ 64K | _filter_img_create
+
+$QEMU_IO -c "write -P 0xaa 0 64k" "$TEST_IMG" | _filter_qemu_io
+
+# Allocate individual subclusters in the top image, and not the whole cluster
+$QEMU_IO -c "write -P 0xbb 28K 2K" -c "write -P 0xcc 34K 2K" "$TEST_WRAP" \
+ | _filter_qemu_io
+
+# Only 2 subclusters should be allocated in the top image at this point
+$QEMU_IMG map "$TEST_WRAP" | _filter_qemu_img_map
+
+# Actual copy-on-read operation
+$QEMU_IO -C -c "read -P 0xaa 30K 4K" "$TEST_WRAP" | _filter_qemu_io
+
+# And here we should have 4 subclusters allocated right in the middle of the
+# top image. Make sure the whole cluster remains unallocated
+$QEMU_IMG map "$TEST_WRAP" | _filter_qemu_img_map
+
+_check_test_img
+
# success, all done
echo '*** done'
status=0
diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out
index ad414c3b0e..8f34a30afe 100644
--- a/tests/qemu-iotests/197.out
+++ b/tests/qemu-iotests/197.out
@@ -31,4 +31,28 @@ read 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1 KiB (0x400) bytes allocated at offset 0 bytes (0x0)
No errors were found on the image.
+
+=== Copy-on-read with subclusters ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=65536 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
+wrote 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2048/2048 bytes at offset 28672
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2048/2048 bytes at offset 34816
+2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Offset Length File
+0 0x7000 TEST_DIR/t.IMGFMT
+0x7000 0x800 TEST_DIR/t.wrap.IMGFMT
+0x7800 0x1000 TEST_DIR/t.IMGFMT
+0x8800 0x800 TEST_DIR/t.wrap.IMGFMT
+0x9000 0x7000 TEST_DIR/t.IMGFMT
+read 4096/4096 bytes at offset 30720
+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Offset Length File
+0 0x7000 TEST_DIR/t.IMGFMT
+0x7000 0x2000 TEST_DIR/t.wrap.IMGFMT
+0x9000 0x7000 TEST_DIR/t.IMGFMT
+No errors were found on the image.
*** done
--
2.41.0
prev parent reply other threads:[~2023-08-29 17:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 17:21 [PULL v2 0/8] Block patches Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 1/8] hw/ufs: Initial commit for emulated Universal-Flash-Storage Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 2/8] hw/ufs: Support for Query Transfer Requests Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 3/8] hw/ufs: Support for UFS logical unit Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 4/8] tests/qtest: Introduce tests for UFS Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 5/8] block-migration: Ensure we don't crash during migration cleanup Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 6/8] block: add subcluster_size field to BlockDriverInfo Stefan Hajnoczi
2023-08-29 17:21 ` [PULL v2 7/8] block/io: align requests to subcluster_size Stefan Hajnoczi
2023-08-29 17:21 ` Stefan Hajnoczi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230829172122.303592-9-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=berrange@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jeuk20.kim@samsung.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=leobras@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.com \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).