From bb499ce3ea390ce3bd9b334ab5817015247d4b47 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 14 Dec 2016 20:49:55 -0800 Subject: [PATCH 1/1] unix_apply.c: preallocate space for regular files --- configure.ac | 2 +- src/unix_apply.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 70b78681..46dd6f0f 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,7 @@ AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"]) # Useful functions which we can do without. AC_CHECK_FUNCS([futimens utimensat flock mempcpy \ - openat fstatat readlinkat fdopendir]) + openat fstatat readlinkat fdopendir posix_fallocate]) # Header checks, most of which are only here to satisfy conditional includes # made by the libntfs-3g headers. diff --git a/src/unix_apply.c b/src/unix_apply.c index 672f39e7..e2ba76f9 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -585,6 +585,9 @@ retry_create: return WIMLIB_ERR_OPEN; } filedes_init(&ctx->open_fds[ctx->num_open_fds++], fd); +#ifdef HAVE_POSIX_FALLOCATE + posix_fallocate(fd, 0, blob->size); +#endif return unix_create_hardlinks(inode, first_dentry, first_path, ctx); } -- 2.43.0