[Libguestfs] [PATCH v2 4/4] file: Zero for block devices on old kernels

Eric Blake eblake at redhat.com
Mon Aug 13 18:00:41 UTC 2018


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?

(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




More information about the Libguestfs mailing list