diff options
author | David Disseldorp <ddiss@samba.org> | 2015-02-10 14:32:07 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-03-09 21:27:07 +0100 |
commit | 47f15b14ae4f3a9d83ed6f7c9ad31e74978e9606 (patch) | |
tree | 59873123cbdb25eeec2e5402acd0e7d5589be3ce /source3/lib | |
parent | 762f9cbe60fe3a5ee6f528276c095ad736c776ee (diff) | |
download | samba-47f15b14ae4f3a9d83ed6f7c9ad31e74978e9606.tar.gz samba-47f15b14ae4f3a9d83ed6f7c9ad31e74978e9606.tar.xz samba-47f15b14ae4f3a9d83ed6f7c9ad31e74978e9606.zip |
system: add hole punch support to sys_fallocate()
If Samba is configured with FALLOC_FL_PUNCH_HOLE support, then allow
sys_fallocate() to propogate the flag to syscall invocation.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/system.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c index fca5855ec3..aba9574877 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -488,6 +488,13 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len) mode &= ~VFS_FALLOCATE_FL_KEEP_SIZE; } +#if defined(HAVE_FALLOC_FL_PUNCH_HOLE) + if (mode & VFS_FALLOCATE_FL_PUNCH_HOLE) { + lmode |= FALLOC_FL_PUNCH_HOLE; + mode &= ~VFS_FALLOCATE_FL_PUNCH_HOLE; + } +#endif /* HAVE_FALLOC_FL_PUNCH_HOLE */ + if (mode != 0) { DEBUG(2, ("unmapped fallocate flags: %lx\n", (unsigned long)mode)); @@ -495,11 +502,11 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len) return -1; } return fallocate(fd, lmode, offset, len); -#else +#else /* HAVE_LINUX_FALLOCATE */ /* TODO - plumb in fallocate from other filesysetms like VXFS etc. JRA. */ errno = ENOSYS; return -1; -#endif +#endif /* HAVE_LINUX_FALLOCATE */ } #if HAVE_KERNEL_SHARE_MODES |