diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2026-02-12 14:35:18 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2026-02-12 14:35:18 +0000 |
| commit | 4ed6a7f2fdc09d9fc3411e83e278da0085122016 (patch) | |
| tree | b8bf6bb01a599ddca69dc9cb8114ee4811ac92bd | |
| parent | 216264cb519a6b8d8dc6962110c0035192e90d3e (diff) | |
| parent | 267d7ae99a1d3b5be9d3421db3bdf651cc18c7ab (diff) | |
| download | qemu-master.zip qemu-master.tar.gz qemu-master.tar.bz2 | |
Merge tag 'pull-block-jobs-2026-02-12' of https://gitlab.com/vsementsov/qemu into stagingHEADstagingmaster
block: mirror: fix zero bitmap handling
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEi5wmzbL9FHyIDoahVh8kwfGfefsFAmmNlVcACgkQVh8kwfGf
# eftwBA/8CzB05/OX8vOONCHYPeZI7i2vjw+3yeAm6iIqD5ICDlrmCl6lJP8TpVfa
# DHLAJVfi8DxIeLL72hORlFNEVNSt5qWYI3s+oJajnbX47gf0UNjqDG/NHeIWBDQU
# B+fBEWtRwvqVHjajfRqYwWx4goFSVRjICYbdQRY5R/1Gmw9DnvGsGj+XkAcoQ23a
# Azoqd8HGnRQbhXmvXi9hJDMlrZW0Yuoi6/Jygo3P4ks9c6BundZZFP87OEAbzzH7
# KNbtaWSjH4N8N39wRIF6qxJ5keaPDCY6hkzvXcbit+d6zoifg5sN4JCRcVJ1R8Se
# w2FIksUl0U2pjQ8/pQbZihH480Mhk2cENh8sSQAyYXc6LtCubR6FngFlf3d0Y9ho
# ky3YVnopm+v2++yJEJmqCKRa4Z3WQszO4eXejoheSiMa48FUs1Vh5QcPU7y/EBJf
# NuA5mN9PRs8eMSJ7HEtufY97LoGeJSQYtfhs9xxsdKmETtHgG7cro1Jl0CDDZToX
# cQdpP/sf/XZBb27/KX+x3GuOWp8MYZ78WsrjFQE1WO1ZG1Mn3Bx4WqwNIJG1W6OT
# ZyYt81OESTN1xBbeWnYUsuxIXzH6uGb3guJ6bTRubhlSMemBlun3u+UyyZqs0Dfj
# hnY1kigl9JRNEQ+SOzAqxBukj0wF5pHJYL/3urM0gmu3V6ypeXA=
# =uqha
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Feb 12 08:54:47 2026 GMT
# gpg: using RSA key 8B9C26CDB2FD147C880E86A1561F24C1F19F79FB
# gpg: Good signature from "Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>" [unknown]
# gpg: aka "Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8B9C 26CD B2FD 147C 880E 86A1 561F 24C1 F19F 79FB
* tag 'pull-block-jobs-2026-02-12' of https://gitlab.com/vsementsov/qemu:
iotests: test active mirror with unaligned, small write zeroes op
block/mirror: check range when setting zero bitmap for sync write
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| -rw-r--r-- | block/mirror.c | 9 | ||||
| -rwxr-xr-x | tests/qemu-iotests/151 | 20 | ||||
| -rw-r--r-- | tests/qemu-iotests/151.out | 4 |
3 files changed, 28 insertions, 5 deletions
diff --git a/block/mirror.c b/block/mirror.c index b344182..bc982cb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1514,9 +1514,12 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method, assert(!qiov); ret = blk_co_pwrite_zeroes(job->target, offset, bytes, flags); if (job->zero_bitmap && ret >= 0) { - bitmap_set(job->zero_bitmap, dirty_bitmap_offset / job->granularity, - (dirty_bitmap_end - dirty_bitmap_offset) / - job->granularity); + if (dirty_bitmap_offset < dirty_bitmap_end) { + bitmap_set(job->zero_bitmap, + dirty_bitmap_offset / job->granularity, + (dirty_bitmap_end - dirty_bitmap_offset) / + job->granularity); + } } break; diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 06ee358..9b9c815 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -191,6 +191,26 @@ class TestActiveMirror(iotests.QMPTestCase): self.potential_writes_in_flight = False + def testUnalignedSmallerThanGranularityWriteZeroes(self): + # Fill the source image + self.vm.hmp_qemu_io('source', 'write -P 1 0 %i' % self.image_len); + + # Start the block job + self.vm.cmd('blockdev-mirror', + job_id='mirror', + filter_node_name='mirror-node', + device='source-node', + target='target-node', + sync='full', + copy_mode='write-blocking') + + # Wait for the READY event + self.wait_ready(drive='mirror') + + for offset in range(6 * self.image_len // 8, 7 * self.image_len // 8, 1024 * 1024): + self.vm.hmp_qemu_io('source', 'aio_write -z %i 512' % (offset + 512)) + + self.complete_and_wait(drive='mirror', wait_ready=False) class TestThrottledWithNbdExportBase(iotests.QMPTestCase): image_len = 128 * 1024 * 1024 # MB diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out index 3f8a935..2f7d390 100644 --- a/tests/qemu-iotests/151.out +++ b/tests/qemu-iotests/151.out @@ -1,5 +1,5 @@ -...... +....... ---------------------------------------------------------------------- -Ran 6 tests +Ran 7 tests OK |
