summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2015-04-16 22:35:15 +0000
committerrmacklem <rmacklem@FreeBSD.org>2015-04-16 22:35:15 +0000
commitb4d8a8d1f73c47bc9d5c91a9eef7413e311478f5 (patch)
tree84f7c08d5b6d400b5484e3ad60fb7156246e822a
parent1ba5532df768c8093d433287cc072581aa2c37bb (diff)
downloadFreeBSD-src-b4d8a8d1f73c47bc9d5c91a9eef7413e311478f5.zip
FreeBSD-src-b4d8a8d1f73c47bc9d5c91a9eef7413e311478f5.tar.gz
mav@ has found that NFS servers exporting ZFS file systems
can perform better when using a 128K read/write data size. This patch changes NFS_MAXDATA from 64K to 128K so that clients can use 128K for NFS mounts to allow this. The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so that it is clear that it applies to the NFS server side only. It also avoids a name conflict with the NFS_MAXDATA defined in rpcsvc/nfs_prot.h, that is used for userland RPC. Tested by: mav Reviewed by: mav MFC after: 2 weeks
-rw-r--r--sys/fs/nfs/nfs.h2
-rw-r--r--sys/fs/nfs/nfs_commonport.c6
-rw-r--r--sys/fs/nfs/nfsproto.h15
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c2
4 files changed, 18 insertions, 7 deletions
diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h
index 6106de9..2ee9145 100644
--- a/sys/fs/nfs/nfs.h
+++ b/sys/fs/nfs/nfs.h
@@ -159,7 +159,7 @@
(t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0)
#define NFS_SRVMAXDATA(n) \
(((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \
- NFS_MAXDATA : NFS_V2MAXDATA)
+ NFS_SRVMAXIO : NFS_V2MAXDATA)
#define NFS64BITSSET 0xffffffffffffffffull
#define NFS64BITSMINUS1 0xfffffffffffffffeull
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 27aca26..2406d34 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -281,11 +281,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram)
if (isdgram)
pref = NFS_MAXDGRAMDATA;
else
- pref = NFS_MAXDATA;
- sip->fs_rtmax = NFS_MAXDATA;
+ pref = NFS_SRVMAXIO;
+ sip->fs_rtmax = NFS_SRVMAXIO;
sip->fs_rtpref = pref;
sip->fs_rtmult = NFS_FABLKSIZE;
- sip->fs_wtmax = NFS_MAXDATA;
+ sip->fs_wtmax = NFS_SRVMAXIO;
sip->fs_wtpref = pref;
sip->fs_wtmult = NFS_FABLKSIZE;
sip->fs_dtpref = pref;
diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h
index 768dfcb..08e7b24 100644
--- a/sys/fs/nfs/nfsproto.h
+++ b/sys/fs/nfs/nfsproto.h
@@ -54,11 +54,10 @@
#define NFS_VER4 4
#define NFS_V2MAXDATA 8192
#define NFS_MAXDGRAMDATA 16384
-#define NFS_MAXDATA NFS_MAXBSIZE
#define NFS_MAXPATHLEN 1024
#define NFS_MAXNAMLEN 255
#define NFS_MAXPKTHDR 404
-#define NFS_MAXPACKET (NFS_MAXDATA + 2048)
+#define NFS_MAXPACKET (NFS_SRVMAXIO + 2048)
#define NFS_MINPACKET 20
#define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
#define NFSV4_MINORVERSION 0 /* V4 Minor version */
@@ -67,6 +66,18 @@
#define NFSV41_CBVERS 4 /* V4.1 CB Version */
#define NFSV4_SMALLSTR 50 /* Strings small enough for stack */
+/*
+ * This value isn't a fixed value in the RFCs.
+ * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for
+ * the server. It should be set to the I/O size preferred by ZFS or
+ * MAXBSIZE, whichever is greater.
+ * ZFS currently prefers 128K.
+ * It used to be called NFS_MAXDATA, but has been renamed to clarify that
+ * it refers to server side only and doesn't conflict with the NFS_MAXDATA
+ * defined in rpcsvc/nfs_prot.h for userland.
+ */
+#define NFS_SRVMAXIO (128 * 1024)
+
/* Stat numbers for rpc returns (version 2, 3 and 4) */
/*
* These numbers are hard-wired in the RFCs, so they can't be changed.
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index e6e02d7..bd0c2da 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -881,7 +881,7 @@ nfsrvd_write(struct nfsrv_descript *nd, __unused int isdgram,
i = mbuf_len(mp);
}
- if (retlen > NFS_MAXDATA || retlen < 0)
+ if (retlen > NFS_SRVMAXIO || retlen < 0)
nd->nd_repstat = EIO;
if (vnode_vtype(vp) != VREG && !nd->nd_repstat) {
if (nd->nd_flag & ND_NFSV3)
OpenPOWER on IntegriCloud