Don't use trim() for zeroing. NBD_CMD_TRIM does not guarantee anything about
the content of the trimmed range. Add allocate flag to zero(), so it can be
used both for sparse and allocated copy.
The zero strategy was less advanced than what we have in nbdkit file plugin.
Port the zero strategy from the file plugin, improving reliability and
compatibility.
Tested with loop devices, local files, and qemu-nbd.
Nir Soffer (2):
nbdcopy: Do not use trim for zeroing
nbdcopy: Port zero strategy from nbdkit
copy/copy-sparse.sh | 66 ++++++++---------
copy/file-ops.c | 141 +++++++++++++++++++++++++++++-------
copy/main.c | 19 +++++
copy/multi-thread-copying.c | 20 ++---
copy/nbd-ops.c | 8 +-
copy/nbdcopy.h | 11 ++-
copy/null-ops.c | 4 +-
copy/synch-copying.c | 8 +-
8 files changed, 190 insertions(+), 87 deletions(-)
--
2.26.2