diff options
author | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2022-06-17 16:23:36 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2022-07-12 10:53:10 -0400 |
commit | 940261a195080cf1cdcd56948d363fe363b69da1 (patch) | |
tree | 4708d6c668cefb7859f4215338b9ae5edc04cbef /fs/nfs/internal.h | |
parent | f1bafa7375c01ff71fb7cb97c06caadfcfe815f3 (diff) |
NFS: Allow setting rsize / wsize to a multiple of PAGE_SIZE
Previously, we required this to value to be a power of 2 for UDP related
reasons. This patch keeps the power of 2 rule for UDP but allows more
flexibility for TCP and RDMA.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r-- | fs/nfs/internal.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 8f8cd6e2d4db..af6d261241ff 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -705,6 +705,24 @@ unsigned long nfs_block_size(unsigned long bsize, unsigned char *nrbitsp) } /* + * Compute and set NFS server rsize / wsize + */ +static inline +unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto) +{ + if (iosize < NFS_MIN_FILE_IO_SIZE) + iosize = NFS_DEF_FILE_IO_SIZE; + else if (iosize >= NFS_MAX_FILE_IO_SIZE) + iosize = NFS_MAX_FILE_IO_SIZE; + else + iosize = iosize & PAGE_MASK; + + if (proto == XPRT_TRANSPORT_UDP) + return nfs_block_bits(iosize, NULL); + return iosize; +} + +/* * Determine the maximum file size for a superblock */ static inline |