diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 19:20:28 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:27 -0400 |
commit | 3a3bab509f3f0e7295caab24e9102ce303edb50b (patch) | |
tree | 59e98615b6323c0b51c52e604fb8812387737a2a /fs | |
parent | 24985c53d5b04a56ac7c8ae7f74b8cb807e2ed2f (diff) |
CIFS: Add SMB2 r/wsize negotiating
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/smb2ops.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index d81e1daeb8f0..20afb756e97a 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/pagemap.h> | ||
20 | #include "cifsglob.h" | 21 | #include "cifsglob.h" |
21 | #include "smb2pdu.h" | 22 | #include "smb2pdu.h" |
22 | #include "smb2proto.h" | 23 | #include "smb2proto.h" |
@@ -157,6 +158,48 @@ smb2_negotiate(const unsigned int xid, struct cifs_ses *ses) | |||
157 | return rc; | 158 | return rc; |
158 | } | 159 | } |
159 | 160 | ||
161 | static unsigned int | ||
162 | smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) | ||
163 | { | ||
164 | struct TCP_Server_Info *server = tcon->ses->server; | ||
165 | unsigned int wsize; | ||
166 | |||
167 | /* start with specified wsize, or default */ | ||
168 | wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE; | ||
169 | wsize = min_t(unsigned int, wsize, server->max_write); | ||
170 | /* | ||
171 | * limit write size to 2 ** 16, because we don't support multicredit | ||
172 | * requests now. | ||
173 | */ | ||
174 | wsize = min_t(unsigned int, wsize, 2 << 15); | ||
175 | |||
176 | /* limit to the amount that we can kmap at once */ | ||
177 | wsize = min_t(unsigned int, wsize, CIFS_KMAP_SIZE_LIMIT); | ||
178 | |||
179 | return wsize; | ||
180 | } | ||
181 | |||
182 | static unsigned int | ||
183 | smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) | ||
184 | { | ||
185 | struct TCP_Server_Info *server = tcon->ses->server; | ||
186 | unsigned int rsize; | ||
187 | |||
188 | /* start with specified rsize, or default */ | ||
189 | rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE; | ||
190 | rsize = min_t(unsigned int, rsize, server->max_read); | ||
191 | /* | ||
192 | * limit write size to 2 ** 16, because we don't support multicredit | ||
193 | * requests now. | ||
194 | */ | ||
195 | rsize = min_t(unsigned int, rsize, 2 << 15); | ||
196 | |||
197 | /* limit to the amount that we can kmap at once */ | ||
198 | rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT); | ||
199 | |||
200 | return rsize; | ||
201 | } | ||
202 | |||
160 | static int | 203 | static int |
161 | smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, | 204 | smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, |
162 | struct cifs_sb_info *cifs_sb, const char *full_path) | 205 | struct cifs_sb_info *cifs_sb, const char *full_path) |
@@ -352,6 +395,8 @@ struct smb_version_operations smb21_operations = { | |||
352 | .print_stats = smb2_print_stats, | 395 | .print_stats = smb2_print_stats, |
353 | .need_neg = smb2_need_neg, | 396 | .need_neg = smb2_need_neg, |
354 | .negotiate = smb2_negotiate, | 397 | .negotiate = smb2_negotiate, |
398 | .negotiate_wsize = smb2_negotiate_wsize, | ||
399 | .negotiate_rsize = smb2_negotiate_rsize, | ||
355 | .sess_setup = SMB2_sess_setup, | 400 | .sess_setup = SMB2_sess_setup, |
356 | .logoff = SMB2_logoff, | 401 | .logoff = SMB2_logoff, |
357 | .tree_connect = SMB2_tcon, | 402 | .tree_connect = SMB2_tcon, |