On Mon, Jul 30, 2018 at 9:16 PM Eric Blake <eblake@redhat.com> wrote:
On 07/30/2018 01:04 PM, Nir Soffer wrote:
> On RHEL 7.5 we need to include <linux/falloc.h> for FALLOC_FL_* macros.

Rather, on any Linux system that pre-dates glibc 2.18, where the flags
were finally supported directly in <fcntl.h>

> Without the macros, fallocate is never used and we fall back to manual
> zeroing.
>

> +++ b/plugins/file/file.c
> @@ -42,6 +42,10 @@
>   #include <sys/stat.h>
>   #include <errno.h>
>   
> +#if defined(__linux__)
> +#include <linux/falloc.h>   /* For FALLOC_FL_* on RHEL, glibc < 2.18 */

Doesn't mention which version of RHEL, nor the fact that non-RHEL
systems may also be impacted (it is the glibc version that matters here,
rather than the distro).

> +#endif
> +

ACK.

Perhaps could be made tighter, with a less ambiguous comment, as:

#if defined(__linux__) && !defined(FALLOC_FL_PUNCH_HOLE)
# include <linux/falloc.h>  /* For FALLOC_FL_*, on glibc < 2.18 */
#endif

but let's see if Rich has any preference between the two.

Both changes are better, I'll post v3 if Rich prefer this.

Nir