summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve French <sfrench@sambaltcdom.austin.ibm.com>2004-12-12 09:13:18 -0600
committerSteve French <cifs.adm@bkbits.net>2004-12-12 09:13:18 -0600
commitc68f5990ca82ed68471795ef243f666aabfe3f89 (patch)
tree8cf80ddcaa4bc2393ef5012a3d411fd2387073cc
parent90f9bb1f25a44f93703b459d384aeba50b4350cd (diff)
[CIFS] Fix CIFS_MAX_MSGSIZE so it can be configured at module_install time,
allowing buffer size to be changed Signed-off-by: Steve French (sfrench@us.ibm.com)
-rw-r--r--fs/cifs/CHANGES6
-rw-r--r--fs/cifs/cifsfs.c7
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/cifssmb.c14
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/cifs/misc.c6
-rw-r--r--fs/cifs/transport.c6
8 files changed, 26 insertions, 21 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 02b3ae6d96de..0e63f6b7c82e 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -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
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 44e8d1b6d0bf..6e506620028a 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -634,13 +634,14 @@ cifs_init_request_bufs(void)
{
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)
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 1c3414c9088c..9175b3849cb5 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -90,5 +90,5 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
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 */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 584f9d25b2b3..4bed8119929e 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -288,7 +288,7 @@ static int validate_t2(struct smb_t2_rsp * pSMB)
(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 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
/* 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 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
__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 @@ findFirstRetry:
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 @@ findFirst2Retry:
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 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon,
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 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
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);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index a0b49a191d74..018ee5af160e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -332,7 +332,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} 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)
||
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 0cc2952b9e7d..fb5eb6eed6ed 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1434,8 +1434,6 @@ cifs_readpages(struct file *file, struct address_space *mapping,
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_readdir(struct file *file, void *direntry, filldir_t filldir)
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;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index cc9b9b7feef9..495504dd1f6a 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -351,7 +351,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
("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 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
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));
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 643001f2c8f3..79f0992a2c6b 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -267,7 +267,7 @@ CIFSSendRcv(const unsigned int xid, struct cifsSesInfo *ses,
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 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
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 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
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));