aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/connect.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 5cc15856e4ad..a66dcb52988c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2930,18 +2930,33 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
2930#define CIFS_DEFAULT_IOSIZE (1024 * 1024) 2930#define CIFS_DEFAULT_IOSIZE (1024 * 1024)
2931 2931
2932/* 2932/*
2933 * Windows only supports a max of 60k reads. Default to that when posix 2933 * Windows only supports a max of 60kb reads and 65535 byte writes. Default to
2934 * extensions aren't in force. 2934 * those values when posix extensions aren't in force. In actuality here, we
2935 * use 65536 to allow for a write that is a multiple of 4k. Most servers seem
2936 * to be ok with the extra byte even though Windows doesn't send writes that
2937 * are that large.
2938 *
2939 * Citation:
2940 *
2941 * http://blogs.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance-tuning.aspx
2935 */ 2942 */
2936#define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024) 2943#define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024)
2944#define CIFS_DEFAULT_NON_POSIX_WSIZE (65536)
2937 2945
2938static unsigned int 2946static unsigned int
2939cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info) 2947cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
2940{ 2948{
2941 __u64 unix_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); 2949 __u64 unix_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
2942 struct TCP_Server_Info *server = tcon->ses->server; 2950 struct TCP_Server_Info *server = tcon->ses->server;
2943 unsigned int wsize = pvolume_info->wsize ? pvolume_info->wsize : 2951 unsigned int wsize;
2944 CIFS_DEFAULT_IOSIZE; 2952
2953 /* start with specified wsize, or default */
2954 if (pvolume_info->wsize)
2955 wsize = pvolume_info->wsize;
2956 else if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))
2957 wsize = CIFS_DEFAULT_IOSIZE;
2958 else
2959 wsize = CIFS_DEFAULT_NON_POSIX_WSIZE;
2945 2960
2946 /* can server support 24-bit write sizes? (via UNIX extensions) */ 2961 /* can server support 24-bit write sizes? (via UNIX extensions) */
2947 if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP)) 2962 if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))