Windows samba clients do a poor-man's preallocation by doing 1 byte writes on 64k boundaries (or something like that) which NTFS interprets to mean "preallocate space" We have a generic interface to filesystem preallocation now, with the fallocate syscall. A very, very simple patch to implement this looks something like: --- a/source/configure.in +++ b/source/configure.in @@ -1052,6 +1052,7 @@ AC_CHECK_FUNCS(setlocale nl_langinfo) AC_CHECK_FUNCS(nanosleep) AC_CHECK_FUNCS(mlock munlock mlockall munlockall) AC_CHECK_FUNCS(memalign posix_memalign hstrerror) +AC_CHECK_FUNCS(fallocate) AC_CHECK_HEADERS(sys/mman.h) # setbuffer, shmget, shm_open are needed for smbtorture AC_CHECK_FUNCS(setbuffer shmget shm_open)Index: samba-3.3.2/source/modules/vfs_default.c --- samba-3.3.2.orig/source/modules/vfs_default.c +++ samba-3.3.2/source/modules/vfs_default.c @@ -714,6 +714,14 @@ static int strict_allocate_ftruncate(vfs if (st.st_size > len) return sys_ftruncate(fsp->fh->fd, len); + /* Growing */ +#if defined(HAVE_FALLOCATE) +#include <linux/falloc.h> + if (!fallocate(fsp->fh->fd, 0, st.st_size, space_to_write)) + return 0; + /* if glibc has fallocate but failed on this fs, go back to old way */ +#endif + /* available disk space is enough or not? */ if (lp_strict_allocate(SNUM(fsp->conn))){ SMB_BIG_UINT space_avail; but this is a little suboptimal; at least on xfs, this multitude of fallocate calls actually has a lot of overhead. If it were possible to batch up these instances into 1 big fallocate call, it could be a win.
Can you check this isnt already adressed upstream ? I see there is a vfs_prealloc module at least.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
vfs_prealloc was specific to xfs, last time I looked. In any case, I see there is movement upstream now, http://lists.samba.org/archive/samba-technical/2010-December/075164.html
oh and FWIW, vfs_prealloc does: Preallocate all files with the extension EXT to the size specified by BYTES. which is not really what we're after (one single preallocated size for all files...)
Upstream has changed to do some fallocate() work already. Closing this one as I think it does not apply anymore in this form. Please reopen if it still applies.