aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index abb831019039..e5cb1941e251 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -213,6 +213,10 @@ struct smb_version_operations {
213 bool (*need_neg)(struct TCP_Server_Info *); 213 bool (*need_neg)(struct TCP_Server_Info *);
214 /* negotiate to the server */ 214 /* negotiate to the server */
215 int (*negotiate)(const unsigned int, struct cifs_ses *); 215 int (*negotiate)(const unsigned int, struct cifs_ses *);
216 /* set negotiated write size */
217 unsigned int (*negotiate_wsize)(struct cifs_tcon *, struct smb_vol *);
218 /* set negotiated read size */
219 unsigned int (*negotiate_rsize)(struct cifs_tcon *, struct smb_vol *);
216 /* setup smb sessionn */ 220 /* setup smb sessionn */
217 int (*sess_setup)(const unsigned int, struct cifs_ses *, 221 int (*sess_setup)(const unsigned int, struct cifs_ses *,
218 const struct nls_table *); 222 const struct nls_table *);
@@ -516,6 +520,63 @@ get_next_mid(struct TCP_Server_Info *server)
516} 520}
517 521
518/* 522/*
523 * When the server supports very large reads and writes via POSIX extensions,
524 * we can allow up to 2^24-1, minus the size of a READ/WRITE_AND_X header, not
525 * including the RFC1001 length.
526 *
527 * Note that this might make for "interesting" allocation problems during
528 * writeback however as we have to allocate an array of pointers for the
529 * pages. A 16M write means ~32kb page array with PAGE_CACHE_SIZE == 4096.
530 *
531 * For reads, there is a similar problem as we need to allocate an array
532 * of kvecs to handle the receive, though that should only need to be done
533 * once.
534 */
535#define CIFS_MAX_WSIZE ((1<<24) - 1 - sizeof(WRITE_REQ) + 4)
536#define CIFS_MAX_RSIZE ((1<<24) - sizeof(READ_RSP) + 4)
537
538/*
539 * When the server doesn't allow large posix writes, only allow a rsize/wsize
540 * of 2^17-1 minus the size of the call header. That allows for a read or
541 * write up to the maximum size described by RFC1002.
542 */
543#define CIFS_MAX_RFC1002_WSIZE ((1<<17) - 1 - sizeof(WRITE_REQ) + 4)
544#define CIFS_MAX_RFC1002_RSIZE ((1<<17) - 1 - sizeof(READ_RSP) + 4)
545
546/*
547 * The default wsize is 1M. find_get_pages seems to return a maximum of 256
548 * pages in a single call. With PAGE_CACHE_SIZE == 4k, this means we can fill
549 * a single wsize request with a single call.
550 */
551#define CIFS_DEFAULT_IOSIZE (1024 * 1024)
552
553/*
554 * Windows only supports a max of 60kb reads and 65535 byte writes. Default to
555 * those values when posix extensions aren't in force. In actuality here, we
556 * use 65536 to allow for a write that is a multiple of 4k. Most servers seem
557 * to be ok with the extra byte even though Windows doesn't send writes that
558 * are that large.
559 *
560 * Citation:
561 *
562 * http://blogs.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance-tuning.aspx
563 */
564#define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024)
565#define CIFS_DEFAULT_NON_POSIX_WSIZE (65536)
566
567/*
568 * On hosts with high memory, we can't currently support wsize/rsize that are
569 * larger than we can kmap at once. Cap the rsize/wsize at
570 * LAST_PKMAP * PAGE_SIZE. We'll never be able to fill a read or write request
571 * larger than that anyway.
572 */
573#ifdef CONFIG_HIGHMEM
574#define CIFS_KMAP_SIZE_LIMIT (LAST_PKMAP * PAGE_CACHE_SIZE)
575#else /* CONFIG_HIGHMEM */
576#define CIFS_KMAP_SIZE_LIMIT (1<<24)
577#endif /* CONFIG_HIGHMEM */
578
579/*
519 * Macros to allow the TCP_Server_Info->net field and related code to drop out 580 * Macros to allow the TCP_Server_Info->net field and related code to drop out
520 * when CONFIG_NET_NS isn't set. 581 * when CONFIG_NET_NS isn't set.
521 */ 582 */