The branch, master has been updated
       via  c0ebca2... s3: optimize strict allocate for XFS on IRIX
      from  77164a8... testprogs: add tests for GetJob() to spoolss test.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c0ebca237c6748365b2400529e02b5c8342e6ecc
Author: Björn Jacke <[email protected]>
Date:   Thu Feb 18 10:01:26 2010 +0100

    s3: optimize strict allocate for XFS on IRIX

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/system.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/system.c b/source3/lib/system.c
index 9c1da3a..58240a3 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -627,6 +627,31 @@ int sys_posix_fallocate(int fd, SMB_OFF_T offset, 
SMB_OFF_T len)
        return posix_fallocate64(fd, offset, len);
 #elif defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_BROKEN_POSIX_FALLOCATE)
        return posix_fallocate(fd, offset, len);
+#elif defined(F_RESVSP64)
+       /* this handles XFS on IRIX */
+       struct flock64 fl;
+       SMB_OFF_T new_len = offset + len;
+       int ret;
+       struct stat64 sbuf;
+
+       /* unlikely to get a too large file on a 64bit system but ... */
+       if (new_len < 0)
+               return EFBIG;
+
+       fl.l_whence = SEEK_SET;
+       fl.l_start = offset;
+       fl.l_len = len;
+
+       ret=fcntl(fd, F_RESVSP64, &fl);
+
+       if (ret != 0)
+               return errno;
+
+       /* Make sure the file gets enlarged after we allocated space: */
+       fstat64(fd, &sbuf);
+       if (new_len > sbuf.st_size)
+               ftruncate64(fd, new_len);
+       return 0;
 #else
        return ENOSYS;
 #endif


-- 
Samba Shared Repository

Reply via email to