- kvm-block-Expand-block-status-mode-from-bool-to-flags.patch [RHEL-88435 RHEL-88437] - kvm-file-posix-gluster-Handle-zero-block-status-hint-bet.patch [RHEL-88435 RHEL-88437] - kvm-block-Let-bdrv_co_is_zero_fast-consolidate-adjacent-.patch [RHEL-88435 RHEL-88437] - kvm-block-Add-new-bdrv_co_is_all_zeroes-function.patch [RHEL-88435 RHEL-88437] - kvm-iotests-Improve-iotest-194-to-mirror-data.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Minor-refactoring.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Pass-full-sync-mode-rather-than-bool-to-inter.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Allow-QMP-override-to-declare-target-already-.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Drop-redundant-zero_target-parameter.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Skip-pre-zeroing-destination-if-it-is-already.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Skip-writing-zeroes-when-target-is-already-ze.patch [RHEL-88435 RHEL-88437] - kvm-iotests-common.rc-add-disk_usage-function.patch [RHEL-88435 RHEL-88437] - kvm-tests-Add-iotest-mirror-sparse-for-recent-patches.patch [RHEL-88435 RHEL-88437] - kvm-mirror-Reduce-I-O-when-destination-is-detect-zeroes-.patch [RHEL-88435 RHEL-88437] - Resolves: RHEL-88435 (--migrate-disks-detect-zeroes doesn't take effect for disk migration [rhel-10.1]) - Resolves: RHEL-88437 (Disk size of target raw image is full allocated when doing mirror with default discard value [rhel-10.1])
91 lines
4.0 KiB
Diff
91 lines
4.0 KiB
Diff
From e95294aecc606deacf716861d716f9178b132ed8 Mon Sep 17 00:00:00 2001
|
|
From: Eric Blake <eblake@redhat.com>
|
|
Date: Fri, 9 May 2025 15:40:23 -0500
|
|
Subject: [PATCH 06/14] mirror: Minor refactoring
|
|
|
|
RH-Author: Eric Blake <eblake@redhat.com>
|
|
RH-MergeRequest: 363: blockdev-mirror: More efficient handling of sparse mirrors
|
|
RH-Jira: RHEL-88435 RHEL-88437
|
|
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Commit: [6/14] 22a87aca8033f3f5d10fd224dc0786633a4d040f (ebblake/centos-qemu-kvm)
|
|
|
|
Commit 5791ba52 (v9.2) pre-initialized ret in mirror_dirty_init to
|
|
silence a false positive compiler warning, even though in all code
|
|
paths where ret is used, it was guaranteed to be reassigned
|
|
beforehand. But since the function returns -errno, and -1 is not
|
|
always the right errno, it's better to initialize to -EIO.
|
|
|
|
An upcoming patch wants to track two bitmaps in
|
|
do_sync_target_write(); this will be easier if the current variables
|
|
related to the dirty bitmap are renamed.
|
|
|
|
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Message-ID: <20250509204341.3553601-21-eblake@redhat.com>
|
|
(cherry picked from commit 870f8963cf1a84f8ec929b05a6d68906974a76c5)
|
|
Jira: https://issues.redhat.com/browse/RHEL-88435
|
|
Jira: https://issues.redhat.com/browse/RHEL-88437
|
|
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
---
|
|
block/mirror.c | 22 +++++++++++-----------
|
|
1 file changed, 11 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/block/mirror.c b/block/mirror.c
|
|
index a53582f17b..34c6c5252e 100644
|
|
--- a/block/mirror.c
|
|
+++ b/block/mirror.c
|
|
@@ -841,7 +841,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
|
|
int64_t offset;
|
|
BlockDriverState *bs;
|
|
BlockDriverState *target_bs = blk_bs(s->target);
|
|
- int ret = -1;
|
|
+ int ret = -EIO;
|
|
int64_t count;
|
|
|
|
bdrv_graph_co_rdlock();
|
|
@@ -1341,7 +1341,7 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
|
|
{
|
|
int ret;
|
|
size_t qiov_offset = 0;
|
|
- int64_t bitmap_offset, bitmap_end;
|
|
+ int64_t dirty_bitmap_offset, dirty_bitmap_end;
|
|
|
|
if (!QEMU_IS_ALIGNED(offset, job->granularity) &&
|
|
bdrv_dirty_bitmap_get(job->dirty_bitmap, offset))
|
|
@@ -1388,11 +1388,11 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
|
|
* Tails are either clean or shrunk, so for bitmap resetting
|
|
* we safely align the range down.
|
|
*/
|
|
- bitmap_offset = QEMU_ALIGN_UP(offset, job->granularity);
|
|
- bitmap_end = QEMU_ALIGN_DOWN(offset + bytes, job->granularity);
|
|
- if (bitmap_offset < bitmap_end) {
|
|
- bdrv_reset_dirty_bitmap(job->dirty_bitmap, bitmap_offset,
|
|
- bitmap_end - bitmap_offset);
|
|
+ dirty_bitmap_offset = QEMU_ALIGN_UP(offset, job->granularity);
|
|
+ dirty_bitmap_end = QEMU_ALIGN_DOWN(offset + bytes, job->granularity);
|
|
+ if (dirty_bitmap_offset < dirty_bitmap_end) {
|
|
+ bdrv_reset_dirty_bitmap(job->dirty_bitmap, dirty_bitmap_offset,
|
|
+ dirty_bitmap_end - dirty_bitmap_offset);
|
|
}
|
|
|
|
job_progress_increase_remaining(&job->common.job, bytes);
|
|
@@ -1430,10 +1430,10 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
|
|
* at function start, and they must be still dirty, as we've locked
|
|
* the region for in-flight op.
|
|
*/
|
|
- bitmap_offset = QEMU_ALIGN_DOWN(offset, job->granularity);
|
|
- bitmap_end = QEMU_ALIGN_UP(offset + bytes, job->granularity);
|
|
- bdrv_set_dirty_bitmap(job->dirty_bitmap, bitmap_offset,
|
|
- bitmap_end - bitmap_offset);
|
|
+ dirty_bitmap_offset = QEMU_ALIGN_DOWN(offset, job->granularity);
|
|
+ dirty_bitmap_end = QEMU_ALIGN_UP(offset + bytes, job->granularity);
|
|
+ bdrv_set_dirty_bitmap(job->dirty_bitmap, dirty_bitmap_offset,
|
|
+ dirty_bitmap_end - dirty_bitmap_offset);
|
|
qatomic_set(&job->actively_synced, false);
|
|
|
|
action = mirror_error_action(job, false, -ret);
|
|
--
|
|
2.39.3
|
|
|