svn commit: r362768 - in projects/nfs-over-tls/sys/fs: nfs nfsclient nfsserver

Rick Macklem rmacklem at FreeBSD.org
Mon Jun 29 02:32:08 UTC 2020


Author: rmacklem
Date: Mon Jun 29 02:32:07 2020
New Revision: 362768
URL: https://svnweb.freebsd.org/changeset/base/362768

Log:
  Delete nfs_use_ext_pgs, since it is not needed.
  
  This patch also removes the checks for PMAP_HAS_DMAP, since they were only
  needed for early testing on i386 hardware, when no actual TLS was being done.
  It also enables use of ext_pgs mbufs for large read replies.

Modified:
  projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c
  projects/nfs-over-tls/sys/fs/nfsclient/nfs_clkrpc.c
  projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c
  projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c
  projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c	Mon Jun 29 00:34:11 2020	(r362767)
+++ projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c	Mon Jun 29 02:32:07 2020	(r362768)
@@ -100,10 +100,6 @@ int nfs_maxcopyrange = 10 * 1024 * 1024;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW,
     &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable");
 
-bool nfs_use_ext_pgs = false;
-SYSCTL_BOOL(_vfs_nfs, OID_AUTO, use_ext_pgs, CTLFLAG_RW, &nfs_use_ext_pgs,
-    0, "Set true to use TCP");
-
 /*
  * This array of structures indicates, for V4:
  * retfh - which of 3 types of calling args are used

Modified: projects/nfs-over-tls/sys/fs/nfsclient/nfs_clkrpc.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsclient/nfs_clkrpc.c	Mon Jun 29 00:34:11 2020	(r362767)
+++ projects/nfs-over-tls/sys/fs/nfsclient/nfs_clkrpc.c	Mon Jun 29 02:32:07 2020	(r362768)
@@ -56,7 +56,6 @@ static int nfs_cbproc(struct nfsrv_descript *, u_int32
 extern u_long sb_max_adj;
 extern int nfs_numnfscbd;
 extern int nfscl_debuglevel;
-extern bool nfs_use_ext_pgs;
 
 /*
  * NFS client system calls for handling callbacks.

Modified: projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c	Mon Jun 29 00:34:11 2020	(r362767)
+++ projects/nfs-over-tls/sys/fs/nfsclient/nfs_clrpcops.c	Mon Jun 29 02:32:07 2020	(r362768)
@@ -77,7 +77,6 @@ extern int nfscl_debuglevel;
 extern int nfs_pnfsiothreads;
 extern u_long sb_max_adj;
 extern int nfs_maxcopyrange;
-extern bool nfs_use_ext_pgs;
 NFSCLSTATEMUTEX;
 int nfstest_outofseq = 0;
 int nfscl_assumeposixlocks = 1;
@@ -1798,8 +1797,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom
 
 	KASSERT(uiop->uio_iovcnt == 1, ("nfs: writerpc iovcnt > 1"));
 	use_ext = false;
-	if ((NFSHASTLS(nmp) || nfs_use_ext_pgs) &&
-	    PMAP_HAS_DMAP != 0)
+	if (NFSHASTLS(nmp))
 		use_ext = true;
 	*attrflagp = 0;
 	tsiz = uiop->uio_resid;
@@ -8495,8 +8493,7 @@ nfsrpc_setextattr(vnode_t vp, const char *name, struct
 
 	*attrflagp = 0;
 	use_ext = false;
-	if (uiop->uio_resid > MCLBYTES && (NFSHASTLS(nmp) ||
-	    nfs_use_ext_pgs) && PMAP_HAS_DMAP != 0)
+	if (uiop->uio_resid > MCLBYTES && NFSHASTLS(nmp))
 		use_ext = true;
 	nfscl_reqstart(nd, NFSPROC_SETEXTATTR, nmp,
 	    VTONFS(vp)->n_fhp->nfh_fh, VTONFS(vp)->n_fhp->nfh_len, NULL,

Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c	Mon Jun 29 00:34:11 2020	(r362767)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c	Mon Jun 29 02:32:07 2020	(r362768)
@@ -77,7 +77,6 @@ extern struct nfsdontlisthead nfsrv_dontlisthead;
 extern volatile int nfsrv_dontlistlen;
 extern volatile int nfsrv_devidcnt;
 extern int nfsrv_maxpnfsmirror;
-extern bool nfs_use_ext_pgs;
 struct vfsoptlist nfsv4root_opt, nfsv4root_newopt;
 NFSDLOCKMUTEX;
 NFSSTATESPINLOCK;
@@ -2115,6 +2114,13 @@ again:
 	vput(vp);
 
 	/*
+	 * If the siz and cnt are larger than MCLBYTES, use ext_pgs for TLS.
+	 */
+	if ((nd->nd_flag & (ND_EXTPG | ND_TLS)) == ND_TLS && siz > MCLBYTES &&
+	    cnt > MCLBYTES)
+		nd->nd_flag |= ND_EXTPG;
+
+	/*
 	 * dirlen is the size of the reply, including all XDR and must
 	 * not exceed cnt. For NFSv2, RFC1094 didn't clearly indicate
 	 * if the XDR should be included in "count", but to be safe, we do.
@@ -2432,6 +2438,16 @@ again:
 	}
 
 	/*
+	 * If the reply is likely to exceed MCLBYTES, then use TLS.
+	 * It is difficult to predict how large each entry will be and
+	 * how many entries have been read, so just assume the directory
+	 * entries grow by a factor of 4 when attributes are included.
+	 */
+	if ((nd->nd_flag & (ND_EXTPG | ND_TLS)) == ND_TLS && cnt > MCLBYTES &&
+	    siz > MCLBYTES / 4)
+		nd->nd_flag |= ND_EXTPG;
+
+	/*
 	 * Save this position, in case there is an error before one entry
 	 * is created.
 	 */
@@ -6275,12 +6291,10 @@ nfsvno_getxattr(struct vnode *vp, char *name, uint32_t
 	len = siz;
 	tlen = NFSM_RNDUP(len);
 	/*
-	 * If the cnt is larger than MCLBYTES, use ext_pgs if
-	 * possible.
+	 * If the cnt is larger than MCLBYTES, use ext_pgs for TLS.
 	 * Always use ext_pgs if ND_EXTPG is set.
 	 */
-	if ((flag & ND_EXTPG) != 0 || (tlen > MCLBYTES &&
-	    PMAP_HAS_DMAP != 0 && ((flag & ND_TLS) != 0 || nfs_use_ext_pgs)))
+	if ((flag & ND_EXTPG) != 0 || ((flag & ND_TLS) != 0 && tlen > MCLBYTES))
 		uiop->uio_iovcnt = nfsrv_createiovec_extpgs(tlen, maxextsiz,
 		    &m, &m2, &iv);
 	else

Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c	Mon Jun 29 00:34:11 2020	(r362767)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c	Mon Jun 29 02:32:07 2020	(r362768)
@@ -67,7 +67,6 @@ extern u_long sb_max_adj;
 extern int nfsrv_pnfsatime;
 extern int nfsrv_maxpnfsmirror;
 extern int nfs_maxcopyrange;
-extern bool nfs_use_ext_pgs;
 
 static int	nfs_async = 0;
 SYSCTL_DECL(_vfs_nfsd);
@@ -857,13 +856,11 @@ nfsrvd_read(struct nfsrv_descript *nd, __unused int is
 	m3 = NULL;
 	if (cnt > 0) {
 		/*
-		 * If the cnt is larger than MCLBYTES, use ext_pgs if
-		 * possible.
+		 * If the cnt is larger than MCLBYTES, use ext_pgs for TLS.
 		 * Always use ext_pgs if ND_EXTPG is set.
 		 */
-		if ((nd->nd_flag & ND_EXTPG) != 0 || (PMAP_HAS_DMAP != 0 &&
-		    ((nd->nd_flag & ND_TLS) != 0 || (nfs_use_ext_pgs &&
-		    cnt > MCLBYTES))))
+		if ((nd->nd_flag & ND_EXTPG) != 0 ||
+		    ((nd->nd_flag & ND_TLS) != 0 && cnt > MCLBYTES))
 			nd->nd_repstat = nfsvno_read(vp, off, cnt, nd->nd_cred,
 			    nd->nd_maxextsiz, p, &m3, &m2);
 		else


More information about the svn-src-projects mailing list