r5548: Stop lying about allocation sizes to Windows clients. It was a nice
authorJeremy Allison <jra@samba.org>
Fri, 25 Feb 2005 02:22:44 +0000 (02:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:55:47 +0000 (10:55 -0500)
idea, and aparently improved performance in some circumstances, but it
breaks the VC++ compiler :-(. Not cool. Fix bug #2146.
Jeremy.
(This used to be commit b9f147634df0126320ffe3b9a23068e76f6c1681)

source3/include/local.h
source3/include/smb_macros.h
source3/smbd/nttrans.c
source3/smbd/trans2.c

index 7ac2e256120ac1892c37c5b86ec514c7d8e485d6..7d5baa21fa82c132c21bcff29ff3cefa1c46070f 100644 (file)
 /* the maximum age in seconds of a password. Should be a lp_ parameter */
 #define MAX_PASSWORD_AGE (21*24*60*60)
 
-/* Allocation roundup. */
-#define SMB_ROUNDUP_ALLOCATION_SIZE 0x100000
-
 /* shall we deny oplocks to clients that get timeouts? */
 #define FASCIST_OPLOCK_BACKOFF 1
 
index 4fa9ffa5ace418c34caf98052185326ed1916333..b1ac617f5cfd79271d4655846b6db2a3bedbf65c 100644 (file)
 /* this is how errors are generated */
 #define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__,__FILE__)
 
-#define SMB_ROUNDUP(x,r) ( ((x)%(r)) ? ( (((x)+(r))/(r))*(r) ) : (x))
-
 /* Extra macros added by Ying Chen at IBM - speed increase by inlining. */
 #define smb_buf(buf) (((char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2)
 #define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2))
index d0d5ddf8710df96a85ba521712e5575a21a5726e..675da4c74786bd534ef476fc40a9c8d7a9e4ea0e 100644 (file)
@@ -929,7 +929,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
        allocation_size |= (((SMB_BIG_UINT)IVAL(inbuf,smb_ntcreate_AllocationSize + 4)) << 32);
 #endif
        if (allocation_size && (allocation_size > (SMB_BIG_UINT)file_len)) {
-               fsp->initial_allocation_size = smb_roundup(allocation_size);
+               fsp->initial_allocation_size = allocation_size;
                if (fsp->is_directory) {
                        close_file(fsp,False);
                        END_PROFILE(SMBntcreateX);
@@ -942,7 +942,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
                        return ERROR_NT(NT_STATUS_DISK_FULL);
                }
        } else {
-               fsp->initial_allocation_size = smb_roundup((SMB_BIG_UINT)file_len);
+               fsp->initial_allocation_size = (SMB_BIG_UINT)file_len;
        }
 
        /* 
@@ -1472,7 +1472,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
        allocation_size |= (((SMB_BIG_UINT)IVAL(params,16)) << 32);
 #endif
        if (allocation_size && (allocation_size > file_len)) {
-               fsp->initial_allocation_size = smb_roundup(allocation_size);
+               fsp->initial_allocation_size = allocation_size;
                if (fsp->is_directory) {
                        close_file(fsp,False);
                        END_PROFILE(SMBntcreateX);
@@ -1484,7 +1484,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
                        return ERROR_NT(NT_STATUS_DISK_FULL);
                }
        } else {
-               fsp->initial_allocation_size = smb_roundup((SMB_BIG_UINT)file_len);
+               fsp->initial_allocation_size = (SMB_BIG_UINT)file_len;
        }
 
        /* Realloc the size of parameters and data we will return */
index b241aa38f47b8836ae8adac8f934d9c9af5a967b..d22705214e4973b26c1da15e28893395baf2b2f7 100644 (file)
@@ -32,21 +32,6 @@ extern struct current_user current_user;
 #define get_file_size(sbuf) ((sbuf).st_size)
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
-/********************************************************************
- Roundup a value to the nearest SMB_ROUNDUP_ALLOCATION_SIZE boundary.
- Only do this for Windows clients.
-********************************************************************/
-
-SMB_BIG_UINT smb_roundup(SMB_BIG_UINT val)
-{
-       /* Only roundup for Windows clients. */
-       enum remote_arch_types ra_type = get_remote_arch();
-       if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) {
-               val = SMB_ROUNDUP(val,SMB_ROUNDUP_ALLOCATION_SIZE);
-       }
-       return val;
-}
-
 /********************************************************************
  Given a stat buffer return the allocated size on disk, taking into
  account sparse files.
@@ -65,8 +50,6 @@ 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;
 
-       ret = smb_roundup(ret);
-
        return ret;
 }
 
@@ -3350,9 +3333,6 @@ 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(allocation_size);
-
                        if(allocation_size != get_file_size(sbuf)) {
                                SMB_STRUCT_STAT new_sbuf;