posix_fallocate/fallocate (commit 716ea734e4cd83a2030ca2cac10056bdaab1a021)

Björn JACKE bj at SerNet.DE
Sat Dec 18 05:32:21 MST 2010

Hi Jeremy,

I wrote up this comment for posix_fallocate. For fallocate this is not correct
as it is a Linux-only call and returns just 0 or 1. So this change is a bit
misleading now...:

--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -848,12 +848,13 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
        space_to_write = len - pst->st_ex_size;
-       /* for allocation try posix_fallocate first. This can fail on some
+       /* for allocation try fallocate first. This can fail on some
           platforms e.g. when the filesystem doesn't support it and no
           emulation is being done by the libc (like on AIX with JFS1). In that
-          case we do our own emulation. posix_fallocate implementations can
+          case we do our own emulation. fallocate implementations can
           return ENOTSUP or EINVAL in cases like that. */
-       ret = SMB_VFS_POSIX_FALLOCATE(fsp, pst->st_ex_size, space_to_write);
+                               pst->st_ex_size, space_to_write);
        if (ret == ENOSPC) {
                errno = ENOSPC;
                return -1;

maybe it would be a better to leave posix_fallocate and fallocate in separate
VFS calls. This will make also a single of them easier to be reaplacable in vfs
modules. I would actually prefer that very much, what do you think?

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen

More information about the samba-technical mailing list