qemu/include/block
Eric Blake 253b43a290 mirror: Drop redundant zero_target parameter
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>
2025-05-14 20:10:12 -05:00
..
accounting.h block: add accounting for zone append operation 2023-05-15 08:18:10 -04:00
aio-wait.h system/cpus: rename qemu_mutex_lock_iothread() to bql_lock() 2024-01-08 10:45:43 -05:00
aio.h aio-posix: Separate AioPolledEvent per AioHandler 2025-03-13 17:57:23 +01:00
aio_task.h block: Remove unused aio_task_pool_empty 2024-09-30 10:53:18 +03:00
block-common.h block: Expand block status mode from bool to flags 2025-05-14 15:33:34 -05:00
block-copy.h copy-before-write: allow specifying minimum cluster size 2024-09-30 10:52:41 +03:00
block-global-state.h block: Add blockdev-set-active QMP command 2025-02-06 14:26:51 +01:00
block-hmp-cmds.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block-io.h block: Add new bdrv_co_is_all_zeroes() function 2025-05-14 16:08:23 -05:00
block.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block_backup.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block_int-common.h block: Expand block status mode from bool to flags 2025-05-14 15:33:34 -05:00
block_int-global-state.h mirror: Drop redundant zero_target parameter 2025-05-14 20:10:12 -05:00
block_int-io.h block: Expand block status mode from bool to flags 2025-05-14 15:33:34 -05:00
block_int.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
blockjob.h Rename "QEMU global mutex" to "BQL" in comments and docs 2024-01-08 10:45:43 -05:00
blockjob_int.h block: Mark block_job_add_bdrv() GRAPH_WRLOCK 2023-11-07 19:14:19 +01:00
dirty-bitmap.h block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK 2023-02-23 19:49:32 +01:00
export.h block/export: Add option to allow export of inactive nodes 2025-02-06 14:46:40 +01:00
fuse.h fuse: Allow exporting BDSs via FUSE 2020-12-11 17:52:39 +01:00
graph-lock.h qemu/compiler: Absorb 'clang-tsa.h' 2025-03-06 14:21:25 +01:00
nbd.h nbd/server: Allow users to adjust handshake limit in QMP 2025-02-11 13:45:47 -06:00
nvme.h hw/nvme: set error status code explicitly for misc commands 2025-02-26 12:40:35 +01:00
qapi.h block: Mark bdrv_get_parent_name() and callers GRAPH_RDLOCK 2023-10-12 16:31:33 +02:00
qdict.h qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
raw-aio.h file-posix: Support FUA writes 2025-03-13 17:44:55 +01:00
replication.h replication: move include out of root directory 2021-05-26 14:49:46 +02:00
reqlist.h block/reqlist: add reqlist_wait_all() 2022-03-07 09:33:30 +01:00
snapshot.h block: remove AioContext locking 2023-12-21 22:49:27 +01:00
thread-pool.h thread-pool: Implement generic (non-AIO) pool support 2025-03-06 06:47:33 +01:00
throttle-groups.h block/throttle-groups: Use ThrottleDirection instread of bool is_write 2023-08-29 10:49:24 +02:00
ufs.h hw/ufs: Add temperature event notification support 2025-03-05 02:13:29 +01:00
write-threshold.h block: Clean up includes 2023-02-08 07:28:05 +01:00