diff options
author | Jeremy Allison <jra@samba.org> | 2010-12-02 16:25:59 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-12-02 16:25:59 -0800 |
commit | 5819a36aef030772f1e9da81655c1f911a10372c (patch) | |
tree | 8746c0f52b94f3b2bd722474b653860b10df2a14 /source3/modules/vfs_default.c | |
parent | de8ceb5364de86f9b016251201474f011c16f6cb (diff) | |
download | samba-5819a36aef030772f1e9da81655c1f911a10372c.tar.gz samba-5819a36aef030772f1e9da81655c1f911a10372c.tar.xz samba-5819a36aef030772f1e9da81655c1f911a10372c.zip |
Move posix_fallocate into the VFS where it belongs.
Jeremy.
Diffstat (limited to 'source3/modules/vfs_default.c')
-rw-r--r-- | source3/modules/vfs_default.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 977a5630ac..63993fed36 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -854,7 +854,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs emulation is being done by the libc (like on AIX with JFS1). In that case we do our own emulation. posix_fallocate implementations can return ENOTSUP or EINVAL in cases like that. */ - ret = sys_posix_fallocate(fsp->fh->fd, st.st_ex_size, space_to_write); + ret = SMB_VFS_POSIX_FALLOCATE(fsp, st.st_ex_size, space_to_write); if (ret == ENOSPC) { errno = ENOSPC; return -1; @@ -862,7 +862,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs if (ret == 0) { return 0; } - DEBUG(10,("strict_allocate_ftruncate: sys_posix_fallocate failed with " + DEBUG(10,("strict_allocate_ftruncate: SMB_VFS_POSIX_FALLOCATE failed with " "error %d. Falling back to slow manual allocation\n", ret)); /* available disk space is enough or not? */ @@ -974,6 +974,19 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O return result; } +static int vfswrap_posix_fallocate(vfs_handle_struct *handle, + files_struct *fsp, + SMB_OFF_T offset, + SMB_OFF_T len) +{ + int result; + + START_PROFILE(syscall_posix_fallocate); + result = sys_posix_fallocate(fsp->fh->fd, offset, len); + END_PROFILE(syscall_posix_fallocate); + return result; +} + static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { bool result; |