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:
@@ -1052,6 +1052,7 @@ AC_CHECK_FUNCS(setlocale nl_langinfo)
AC_CHECK_FUNCS(mlock munlock mlockall munlockall)
AC_CHECK_FUNCS(memalign posix_memalign hstrerror)
# 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
@@ -714,6 +714,14 @@ static int strict_allocate_ftruncate(vfs
if (st.st_size > len)
return sys_ftruncate(fsp->fh->fd, len);
+ /* Growing */
+ 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 */
/* available disk space is enough or not? */
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,
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.