summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-12-20 16:53:16 -0800
committerJeremy Allison <jra@samba.org>2010-12-21 02:41:23 +0100
commit8998f4b01310e4b45e75d8d5f3260b5ba5c1cdf9 (patch)
tree21e648af9bd549f577ab8cbf59ebdeb89963cbd7 /source3/smbd
parent09aea038139f8717d38f0fdae6be9cf46bd86b15 (diff)
downloadsamba-8998f4b01310e4b45e75d8d5f3260b5ba5c1cdf9.tar.gz
samba-8998f4b01310e4b45e75d8d5f3260b5ba5c1cdf9.tar.bz2
samba-8998f4b01310e4b45e75d8d5f3260b5ba5c1cdf9.zip
Added call out to a Linux-compatible fallocate() when we need to extend a file
allocation extent without changing end-of-file size. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Dec 21 02:41:24 CET 2010 on sn-devel-104
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/vfs.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 2ebe2a1062..802639f2fb 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -501,13 +501,24 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
return ret;
}
+ if (!lp_strict_allocate(SNUM(fsp->conn)))
+ return 0;
+
/* Grow - we need to test if we have enough space. */
contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_GROW);
+
+ /* See if we have a syscall that will allocate beyond end-of-file
+ without changing EOF. */
+ ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_KEEP_SIZE, 0, len);
+
contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_ALLOC_GROW);
- if (!lp_strict_allocate(SNUM(fsp->conn)))
+ if (ret == 0) {
+ /* We changed the allocation size on disk, but not
+ EOF - exactly as required. We're done ! */
return 0;
+ }
len -= fsp->fsp_name->st.st_ex_size;
len /= 1024; /* Len is now number of 1k blocks needed. */