summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2009-12-08 21:13:19 +0100
committerBjörn Jacke <bj@sernet.de>2009-12-08 21:16:31 +0100
commit0d53ce7e072d3dc5208fd752c5d49ed313d1c752 (patch)
treedc8cbcf0e2c0cc244e7ff7dee23c83c41372deec /source3/modules
parente14fb8f913e35db96d8d7985e505f96150d9ce6b (diff)
downloadsamba-0d53ce7e072d3dc5208fd752c5d49ed313d1c752.tar.gz
samba-0d53ce7e072d3dc5208fd752c5d49ed313d1c752.tar.bz2
samba-0d53ce7e072d3dc5208fd752c5d49ed313d1c752.zip
s3: make sys_posix_fallocate more generic
this is in preparation for other preallocation methods to be introduced.
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_default.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 9b842df93f..ded4b1af27 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -917,6 +917,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
SMB_OFF_T space_to_write;
uint64_t space_avail;
uint64_t bsize,dfree,dsize;
+ int ret;
if (currpos == -1)
return -1;
@@ -943,21 +944,17 @@ 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. */
-#if defined(HAVE_POSIX_FALLOCATE)
- {
- int ret = sys_posix_fallocate(fsp->fh->fd, st.st_ex_size, space_to_write);
- if (ret == ENOSPC) {
- errno = ENOSPC;
- return -1;
- }
- if (ret == 0) {
- return 0;
- }
- DEBUG(10,("strict_allocate_ftruncate: sys_posix_fallocate "
- "failed with error %d. "
- "Falling back to slow manual allocation\n", ret));
+ ret = sys_posix_fallocate(fsp->fh->fd, st.st_ex_size, space_to_write);
+ if (ret == ENOSPC) {
+ errno = ENOSPC;
+ return -1;
}
-#endif
+ if (ret == 0) {
+ return 0;
+ }
+ DEBUG(10,("strict_allocate_ftruncate: sys_posix_fallocate failed with "
+ "error %d. Falling back to slow manual allocation\n", ret));
+
/* available disk space is enough or not? */
space_avail = get_dfree_info(fsp->conn,
fsp->fsp_name->base_name, false,