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.
Changes since v1:
- Rebase after struct rw refactoring
- Fix block device checks
- Improve formatting (Rich)
Nir Soffer (3):
copy/file-ops.c: Fix copy for block device
copy: Do not use trim for zeroing
copy/file-ops.c: Port zero strategy from nbdkit
copy/copy-sparse.sh | 66 +++++++-------
copy/file-ops.c | 168 +++++++++++++++++++++++++++++-------
copy/multi-thread-copying.c | 20 ++---
copy/nbd-ops.c | 11 +--
copy/nbdcopy.h | 5 +-
copy/null-ops.c | 4 +-
copy/synch-copying.c | 8 +-
7 files changed, 193 insertions(+), 89 deletions(-)
--
2.26.2