summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-03-03 03:43:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:52 -0500
commit02fdabc2a7f0199bc5f42afb2c744f3c740122e4 (patch)
treeb3d1aa15b6da888095e2dcecd4976165babb7957 /source3/smbd/trans2.c
parent8dddd763d876cc7a340ffb7813f87187d77b84f2 (diff)
downloadsamba-02fdabc2a7f0199bc5f42afb2c744f3c740122e4.tar.gz
samba-02fdabc2a7f0199bc5f42afb2c744f3c740122e4.tar.bz2
samba-02fdabc2a7f0199bc5f42afb2c744f3c740122e4.zip
r5636: Re-add the allocation size - parameterized by share as
"allocation roundup size", by default set as 1Mb. From advice by BlueArc about Windows client behaviour. VC++ people can set this to zero to turn it off. Jeremy. (This used to be commit 833ca101772bfab65dbd79eb64f63464177f144e)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index d22705214e..16cea326f9 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -33,6 +33,23 @@ extern struct current_user current_user;
#define DIR_ENTRY_SAFETY_MARGIN 4096
/********************************************************************
+ Roundup a value to the nearest allocation roundup size boundary.
+ Only do this for Windows clients.
+********************************************************************/
+
+SMB_BIG_UINT smb_roundup(connection_struct *conn, SMB_BIG_UINT val)
+{
+ SMB_BIG_UINT rval = lp_allocation_roundup_size(SNUM(conn));
+
+ /* Only roundup for Windows clients. */
+ enum remote_arch_types ra_type = get_remote_arch();
+ if (rval && (ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) {
+ val = SMB_ROUNDUP(val,rval);
+ }
+ return val;
+}
+
+/********************************************************************
Given a stat buffer return the allocated size on disk, taking into
account sparse files.
********************************************************************/
@@ -50,7 +67,7 @@ SMB_BIG_UINT get_allocation_size(files_struct *fsp, SMB_STRUCT_STAT *sbuf)
if (!ret && fsp && fsp->initial_allocation_size)
ret = fsp->initial_allocation_size;
- return ret;
+ return smb_roundup(fsp->conn, ret);
}
/****************************************************************************
@@ -3333,6 +3350,10 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
DEBUG(10,("call_trans2setfilepathinfo: Set file allocation info for file %s to %.0f\n",
fname, (double)allocation_size ));
+ if (allocation_size) {
+ allocation_size = smb_roundup(conn, allocation_size);
+ }
+
if(allocation_size != get_file_size(sbuf)) {
SMB_STRUCT_STAT new_sbuf;