#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "lib/pthreadpool/pthreadpool.h"
+#ifdef HAVE_LINUX_FALLOC_H
+#include <linux/falloc.h>
+#endif
struct aio_extra;
static struct pthreadpool *pool;
char *dname;
struct smbd_server_connection *sconn;
const struct security_unix_token *ux_tok;
+ uint64_t initial_allocation_size;
/* Returns. */
int ret_fd;
int ret_errno;
} else {
/* Create was successful. */
opd->ret_errno = 0;
+
+#if defined(HAVE_LINUX_FALLOCATE)
+ /*
+ * See if we can set the initial
+ * allocation size. We don't record
+ * the return for this as it's an
+ * optimization - the upper layer
+ * will also do this for us once
+ * the open returns.
+ */
+ if (opd->initial_allocation_size) {
+ (void)fallocate(opd->ret_fd,
+ FALLOC_FL_KEEP_SIZE,
+ 0,
+ (off_t)opd->initial_allocation_size);
+ }
+#endif
}
}
opd->mid = fsp->mid;
opd->in_progress = true;
opd->sconn = fsp->conn->sconn;
+ opd->initial_allocation_size = fsp->initial_allocation_size;
/* Copy our current credentials. */
opd->ux_tok = copy_unix_token(opd, get_current_utok(fsp->conn));