svn commit: samba r5549 - in trunk/source: include smbd

jra at samba.org jra at samba.org
Fri Feb 25 02:23:01 GMT 2005


Author: jra
Date: 2005-02-25 02:22:57 +0000 (Fri, 25 Feb 2005)
New Revision: 5549

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5549

Log:
Stop lying about allocation sizes to Windows clients. It was a nice
idea, and aparently improved performance in some circumstances, but it
breaks the VC++ compiler :-(. Not cool. Fix bug #2146.
Jeremy.

Modified:
   trunk/source/include/local.h
   trunk/source/include/smb_macros.h
   trunk/source/smbd/nttrans.c
   trunk/source/smbd/trans2.c


Changeset:
Modified: trunk/source/include/local.h
===================================================================
--- trunk/source/include/local.h	2005-02-25 02:22:44 UTC (rev 5548)
+++ trunk/source/include/local.h	2005-02-25 02:22:57 UTC (rev 5549)
@@ -198,9 +198,6 @@
 /* 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
 

Modified: trunk/source/include/smb_macros.h
===================================================================
--- trunk/source/include/smb_macros.h	2005-02-25 02:22:44 UTC (rev 5548)
+++ trunk/source/include/smb_macros.h	2005-02-25 02:22:57 UTC (rev 5549)
@@ -178,8 +178,6 @@
 /* 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))

Modified: trunk/source/smbd/nttrans.c
===================================================================
--- trunk/source/smbd/nttrans.c	2005-02-25 02:22:44 UTC (rev 5548)
+++ trunk/source/smbd/nttrans.c	2005-02-25 02:22:57 UTC (rev 5549)
@@ -931,7 +931,7 @@
 	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);
@@ -944,7 +944,7 @@
 			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;
 	}
 
 	/* 
@@ -1474,7 +1474,7 @@
 	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);
@@ -1486,7 +1486,7 @@
 			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 */

Modified: trunk/source/smbd/trans2.c
===================================================================
--- trunk/source/smbd/trans2.c	2005-02-25 02:22:44 UTC (rev 5548)
+++ trunk/source/smbd/trans2.c	2005-02-25 02:22:57 UTC (rev 5549)
@@ -33,21 +33,6 @@
 #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 @@
 	if (!ret && fsp && fsp->initial_allocation_size)
 		ret = fsp->initial_allocation_size;
 
-	ret = smb_roundup(ret);
-
 	return ret;
 }
 
@@ -3350,9 +3333,6 @@
 			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;
  



More information about the samba-cvs mailing list