Eric Blake <ebl...@redhat.com> writes: > Qemu's attempts to learn whether a destination file starts life with
QEMU (multiple times). > all zero contents are just a hueristic. There may be cases where the heuristic > caller is aware of information that qemu cannot learn quickly, in > which case telling qemu what to assume about the destination can make > the mirror operation faster. Given our existing example of "qemu-img > convert --target-is-zero", it is time to expose this override in QMP > for blockdev-mirror as well. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > qapi/block-core.json | 9 ++++++++- > include/block/block_int-global-state.h | 3 ++- > block/mirror.c | 19 +++++++++++++------ > blockdev.c | 18 +++++++++++------- > tests/unit/test-block-iothread.c | 2 +- > 5 files changed, 35 insertions(+), 16 deletions(-) > > diff --git a/qapi/block-core.json b/qapi/block-core.json > index b1937780e19..6d6185a336a 100644 > --- a/qapi/block-core.json > +++ b/qapi/block-core.json > @@ -2538,6 +2538,12 @@ > # disappear from the query list without user intervention. > # Defaults to true. (Since 3.1) > # > +# @target-is-zero: Assume the destination read as all zeroes before reads > +# the mirror started, even if qemu is unable to quickly learn that QEMU > +# from the destination. Default false, since setting this to true > +# when the destination is not already zero can lead to a corrupt > +# destination. (Since 9.1) 10.1 The "even if" clause is confusing. How would I decide that "QEMU is unable to learn"? According to the commit message, the purpose of the flag is to maybe speed up things when we know the destination is all zeroes, but that's less than obvious from the doc string. > +# Here's my attempt: # @target-is-zero: Assume the destination read as all zeroes before # the mirror started. Setting this to true can speed up the # mirror. Setting this to true when the destination is not # actually all zero can corrupt the destination. (Since 10.1) > # Since: 2.6 > # > # .. qmp-example:: > @@ -2557,7 +2563,8 @@ > '*on-target-error': 'BlockdevOnError', > '*filter-node-name': 'str', > '*copy-mode': 'MirrorCopyMode', > - '*auto-finalize': 'bool', '*auto-dismiss': 'bool' }, > + '*auto-finalize': 'bool', '*auto-dismiss': 'bool', > + '*target-is-zero': 'bool'}, > 'allow-preconfig': true } > > ## [...]