On Thu, Aug 2, 2018 at 10:06 PM Nir Soffer <nirsof@gmail.com> wrote:
This is the second version to support efficient zero for block devices
on older kernels (e.g. RHEL 7.5), and file systems that do not support
yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2).

Changes since v1:
- Split to smaller patches
- Skip linux only includes on other systems
- Skip code using BLKZEROOUT if the macro is not defined
- Try BLKZEROOUT only if the offset and count are aligned to device
  sector size.

Other changes I forgot to mention (interrupted by a child):
- initialize h->can_* properly. Before they were uninitialized if FALLOC_FL_*
  macros were not defined. 
- Use new h->can_punch_hole in file_can_trim, so now we report the actual
  capability once we detected it.
- Use h->can_punch_hole in file_trim, so we try only once if the operation is not
  supported.


v1 was here:
https://www.redhat.com/archives/libguestfs/2018-July/msg00084.html

Nir Soffer (3):
  file: Avoid unsupported fallocate() calls
  file: Support zero without ZERO_RANGE
  file: Zero for block devices on old kernels

 plugins/file/file.c | 194 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 147 insertions(+), 47 deletions(-)

--
2.17.1