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
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
v1 was here:
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(-)