On Mon, Aug 13, 2018 at 9:00 PM Eric Blake <eblake@redhat.com> wrote:
On 08/03/2018 02:28 PM, Nir Soffer wrote:
> fallocate(FALLOC_FL_ZERO_RANGE) is supportd for block devices with

s/supportd/supported/

> modern kernel, but when it is not, we fall back to manual zeroing.
>
> For block device, try also to use ioctl(BLKZEROOUT) if offset and count
> are aligned to block device sector size.
>
> Here is an example run without this change on RHEL 7.5:
>

> +++ b/plugins/file/file.c
> @@ -41,14 +41,21 @@
>   #include <unistd.h>
>   #include <sys/types.h>
>   #include <sys/stat.h>
> +#include <sys/ioctl.h>

Linux-specific header; will it cause grief on BSD compilation?

I did not know that, will wrap it with #ifdef __linux__
 

(POSIX declares ioctl() in <stropts.h>, but for the obsolete STREAMS
extension that no one but Solaris ever implemented, and which no one
uses today - and thus which has little bearing on the Linux use of ioctl).

Otherwise looks okay.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org