mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
![]() The two callers to a mirror job (drive-mirror and blockdev-mirror) set zero_target precisely when sync mode == FULL, with the one exception that drive-mirror skips zeroing the target if it was newly created and reads as zero. But given the previous patch, that exception is equally captured by target_is_zero. Meanwhile, there is another slight wrinkle, fortunately caught by iotest 185: if the caller uses "sync":"top" but the source has no backing file, the code in blockdev.c was changing sync to be FULL, but only after it had set zero_target=false. In mirror.c, prior to recent patches, this didn't matter: the only places that inspected sync were setting is_none_mode (both TOP and FULL had set that to false), and mirror_start() setting base = mode == MIRROR_SYNC_MODE_TOP ? bdrv_backing_chain_next(bs) : NULL. But now that we are passing sync around, the slammed sync mode would result in a new pre-zeroing pass even when the user had passed "sync":"top" in an effort to skip pre-zeroing. Fortunately, the assignment of base when bs has no backing chain still works out to NULL if we don't slam things. So with the forced change of sync ripped out of blockdev.c, the sync mode is passed through the full callstack unmolested, and we can now reliably reconstruct the same settings as what used to be passed in by zero_target=false, without the redundant parameter. Signed-off-by: Eric Blake <eblake@redhat.com> Message-ID: <20250509204341.3553601-24-eblake@redhat.com> Reviewed-by: Sunny Zhu <sunnyzhyy@qq.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [eblake: Fix regression in iotest 185] Signed-off-by: Eric Blake <eblake@redhat.com> |
||
---|---|---|
.. | ||
accounting.h | ||
aio-wait.h | ||
aio.h | ||
aio_task.h | ||
block-common.h | ||
block-copy.h | ||
block-global-state.h | ||
block-hmp-cmds.h | ||
block-io.h | ||
block.h | ||
block_backup.h | ||
block_int-common.h | ||
block_int-global-state.h | ||
block_int-io.h | ||
block_int.h | ||
blockjob.h | ||
blockjob_int.h | ||
dirty-bitmap.h | ||
export.h | ||
fuse.h | ||
graph-lock.h | ||
nbd.h | ||
nvme.h | ||
qapi.h | ||
qdict.h | ||
raw-aio.h | ||
replication.h | ||
reqlist.h | ||
snapshot.h | ||
thread-pool.h | ||
throttle-groups.h | ||
ufs.h | ||
write-threshold.h |