svn commit: linux-cifs-client r19 - in branches/linux-2.6bk/fs/cifs: .

sfrench at samba.org sfrench at samba.org
Mon Dec 13 04:17:27 GMT 2004


Author: sfrench
Date: 2004-12-13 04:17:27 +0000 (Mon, 13 Dec 2004)
New Revision: 19

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=linux-cifs-client&rev=19

Log:
Add support for changing cifs buffer size on insmod

Modified:
   branches/linux-2.6bk/fs/cifs/CHANGES
   branches/linux-2.6bk/fs/cifs/cifsfs.c
   branches/linux-2.6bk/fs/cifs/cifsfs.h
   branches/linux-2.6bk/fs/cifs/cifssmb.c
   branches/linux-2.6bk/fs/cifs/connect.c
   branches/linux-2.6bk/fs/cifs/file.c
   branches/linux-2.6bk/fs/cifs/misc.c
   branches/linux-2.6bk/fs/cifs/transport.c


Changeset:
Modified: branches/linux-2.6bk/fs/cifs/CHANGES
===================================================================
--- branches/linux-2.6bk/fs/cifs/CHANGES	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/CHANGES	2004-12-13 04:17:27 UTC (rev 19)
@@ -1,3 +1,9 @@
+Version 1.28
+------------
+Add module init parm for large SMB buffer size (to allow it to be changed
+from its default of 16K) which is especially useful for large file copy
+when mounting with the directio mount option.
+
 Version 1.27
 ------------
 Turn off DNOTIFY (directory change notification support) by default

Modified: branches/linux-2.6bk/fs/cifs/cifsfs.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/cifsfs.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/cifsfs.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -634,13 +634,14 @@
 {
 	if(CIFSMaxBufSize < 4096) {
 		CIFSMaxBufSize = 4096;
-		cFYI(1,("Buffer size set to minimum of 1 page (4096)"));
 	} else if (CIFSMaxBufSize > 1024*127) {
 		CIFSMaxBufSize = 1024 * 127;
-		cFYI(1,("Buffer size set to maximum"));
+	} else {
+		CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
 	}
+/*	cERROR(1,("CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize)); */
 	cifs_req_cachep = kmem_cache_create("cifs_request",
-					    CIFS_MAX_MSGSIZE +
+					    CIFSMaxBufSize +
 					    MAX_CIFS_HDR_SIZE, 0,
 					    SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if (cifs_req_cachep == NULL)

Modified: branches/linux-2.6bk/fs/cifs/cifsfs.h
===================================================================
--- branches/linux-2.6bk/fs/cifs/cifsfs.h	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/cifsfs.h	2004-12-13 04:17:27 UTC (rev 19)
@@ -90,5 +90,5 @@
 			 size_t, int);
 extern ssize_t	cifs_getxattr(struct dentry *, const char *, void *, size_t);
 extern ssize_t	cifs_listxattr(struct dentry *, char *, size_t);
-#define CIFS_VERSION   "1.27"
+#define CIFS_VERSION   "1.28"
 #endif				/* _CIFSFS_H */

Modified: branches/linux-2.6bk/fs/cifs/cifssmb.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/cifssmb.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/cifssmb.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -288,7 +288,7 @@
 					(char *)pSMB;
 				if((total_size <= (*(u16 *)pBCC)) && 
 				   (total_size < 
-					CIFS_MAX_MSGSIZE+MAX_CIFS_HDR_SIZE)) {
+					CIFSMaxBufSize+MAX_CIFS_HDR_SIZE)) {
 					return 0;
 				}
 				
@@ -341,7 +341,7 @@
 		/* probably no need to store and check maxvcs */
 		server->maxBuf =
 			min(le32_to_cpu(pSMBr->MaxBufferSize),
-			(__u32) CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE);
+			(__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
 		server->maxRw = le32_to_cpu(pSMBr->MaxRawSize);
 		cFYI(0, ("Max buf = %d ", ses->server->maxBuf));
 		GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey);
@@ -823,7 +823,7 @@
 		__u16 data_length = le16_to_cpu(pSMBr->DataLength);
 		*nbytes = data_length;
 		/*check that DataLength would not go beyond end of SMB */
-		if ((data_length > CIFS_MAX_MSGSIZE) 
+		if ((data_length > CIFSMaxBufSize) 
 				|| (data_length > count)) {
 			cFYI(1,("bad length %d for count %d",data_length,count));
 			rc = -EIO;
@@ -2359,7 +2359,7 @@
 	pSMB->SearchAttributes =
 	    cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM |
 			ATTR_DIRECTORY);
-	pSMB->SearchCount = cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_DIRECTORY_INFO));	/* should this be shrunk even more ? */
+	pSMB->SearchCount = cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_DIRECTORY_INFO));	/* should this be shrunk even more ? */
 	pSMB->SearchFlags = cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME);
 
 	/* test for Unix extensions */
@@ -2475,7 +2475,7 @@
 	pSMB->SearchAttributes =
 	    cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM |
 			ATTR_DIRECTORY);
-	pSMB->SearchCount= cpu_to_le16(CIFS_MAX_MSGSIZE/sizeof(FILE_UNIX_INFO));
+	pSMB->SearchCount= cpu_to_le16(CIFSMaxBufSize/sizeof(FILE_UNIX_INFO));
 	pSMB->SearchFlags = cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | 
 		CIFS_SEARCH_RETURN_RESUME);
 	pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
@@ -2576,7 +2576,7 @@
 	pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT);
 	pSMB->SearchHandle = searchHandle;      /* always kept as le */
 	pSMB->SearchCount =
-		cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_UNIX_INFO));
+		cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_UNIX_INFO));
 	/* test for Unix extensions */
 /*	if (tcon->ses->capabilities & CAP_UNIX) {
 		pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_UNIX);
@@ -2704,7 +2704,7 @@
 	pSMB->SearchHandle = searchHandle;	/* always kept as le */
 	findParms->SearchCount = 0;	/* set to zero in case of error */
 	pSMB->SearchCount =
-	    cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_UNIX_INFO));
+	    cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_UNIX_INFO));
 	/* test for Unix extensions */
 	if (tcon->ses->capabilities & CAP_UNIX) {
 		pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_UNIX);

Modified: branches/linux-2.6bk/fs/cifs/connect.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/connect.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/connect.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -332,7 +332,7 @@
 			} else {
 				if (/*(length != sizeof (struct smb_hdr) - 1)
 				    ||*/ (pdu_length >
-					CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE)
+					CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)
 				    || (pdu_length <
 					sizeof (struct smb_hdr) - 1)
 				    ||

Modified: branches/linux-2.6bk/fs/cifs/file.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/file.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/file.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -1434,8 +1434,6 @@
 			spin_unlock(&pTcon->stat_lock);
 #endif
 			if((int)(bytes_read & PAGE_CACHE_MASK) != bytes_read) {
-				cFYI(1,("Partial page %d of %d read to cache",i++,num_pages));
-
 				i++; /* account for partial page */
 
 				/* server copy of file can have smaller size than client */
@@ -1946,7 +1944,7 @@
 	cifs_sb = CIFS_SB(file->f_dentry->d_sb);
 	pTcon = cifs_sb->tcon;
 	bufsize = pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE;
-	if(bufsize > CIFS_MAX_MSGSIZE) {
+	if(bufsize > CIFSMaxBufSize) {
 		rc = -EIO;
 		FreeXid(xid);
 		return rc;

Modified: branches/linux-2.6bk/fs/cifs/misc.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/misc.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/misc.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -351,7 +351,7 @@
 	     ("Entering checkSMB with Length: %x, smb_buf_length: %x ",
 	      length, len));
 	if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) ||
-	    (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) {
+	    (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) {
 		if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) {
 			cERROR(1, ("Length less than 2 + sizeof smb_hdr "));
 			if (((unsigned int)length >= sizeof (struct smb_hdr) - 1)
@@ -359,9 +359,9 @@
 				return 0;	/* some error cases do not return wct and bcc */
 
 		}
-		if (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)
+		if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)
 			cERROR(1,
-			       ("smb_buf_length greater than CIFS_MAX_MSGSIZE ... "));
+			       ("smb_buf_length greater than MaxBufSize"));
 		cERROR(1,
 		       ("bad smb detected. Illegal length. The mid=%d",
 			smb->Mid));

Modified: branches/linux-2.6bk/fs/cifs/transport.c
===================================================================
--- branches/linux-2.6bk/fs/cifs/transport.c	2004-12-12 21:36:55 UTC (rev 18)
+++ branches/linux-2.6bk/fs/cifs/transport.c	2004-12-13 04:17:27 UTC (rev 19)
@@ -267,7 +267,7 @@
 		return -ENOMEM;
 	}
 
-	if (in_buf->smb_buf_length > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) {
+	if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
 		up(&ses->server->tcpSem);
 		cERROR(1,
 		       ("Illegal length, greater than maximum frame, %d ",
@@ -397,7 +397,7 @@
 		return -ENOMEM;
 	}
 
-	if (in_buf->smb_buf_length > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) {
+	if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
 		up(&ses->server->tcpSem);
 		cERROR(1,
 		       ("Illegal length, greater than maximum frame, %d ",
@@ -494,7 +494,7 @@
 		return rc;
 	}
   
-	if (receive_len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) {
+	if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
 		cERROR(1,
 		       ("Frame too large received.  Length: %d  Xid: %d",
 			receive_len, xid));



More information about the samba-cvs mailing list