Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jul 2020 01:19:29 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362903 - head/sys/fs/nfs
Message-ID:  <202007030119.0631JTvr042079@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Fri Jul  3 01:19:29 2020
New Revision: 362903
URL: https://svnweb.freebsd.org/changeset/base/362903

Log:
  Add support for ext_pgs mbufs to nfsm_build().
  
  This is the first of a series of commits that add support to the NFS client
  and server for building RPC messages in ext_pgs mbufs with anonymous pages.
  This is useful so that the entire mbuf list does not need to be
  copied before calling sosend() when NFS over TLS is enabled.
  
  Since ND_EXTPG is never set yet, there is no semantic change at this time.

Modified:
  head/sys/fs/nfs/nfsm_subs.h
  head/sys/fs/nfs/nfsport.h

Modified: head/sys/fs/nfs/nfsm_subs.h
==============================================================================
--- head/sys/fs/nfs/nfsm_subs.h	Fri Jul  3 00:09:41 2020	(r362902)
+++ head/sys/fs/nfs/nfsm_subs.h	Fri Jul  3 01:19:29 2020	(r362903)
@@ -64,14 +64,27 @@ nfsm_build(struct nfsrv_descript *nd, int siz)
 	void *retp;
 	struct mbuf *mb2;
 
-	if (siz > M_TRAILINGSPACE(nd->nd_mb)) {
+	if ((nd->nd_flag & ND_EXTPG) == 0 &&
+	    siz > M_TRAILINGSPACE(nd->nd_mb)) {
 		NFSMCLGET(mb2, M_NOWAIT);
 		if (siz > MLEN)
 			panic("build > MLEN");
 		mb2->m_len = 0;
-		nd->nd_bpos = mtod(mb2, caddr_t);
+		nd->nd_bpos = mtod(mb2, char *);
 		nd->nd_mb->m_next = mb2;
 		nd->nd_mb = mb2;
+	} else if ((nd->nd_flag & ND_EXTPG) != 0) {
+		if (siz > nd->nd_bextpgsiz) {
+			mb2 = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK);
+			nd->nd_bpos = (char *)(void *)
+			    PHYS_TO_DMAP(mb2->m_epg_pa[0]);
+			nd->nd_bextpg = 0;
+			nd->nd_bextpgsiz = PAGE_SIZE - siz;
+			nd->nd_mb->m_next = mb2;
+			nd->nd_mb = mb2;
+		} else
+			nd->nd_bextpgsiz -= siz;
+		nd->nd_mb->m_epg_last_len += siz;
 	}
 	retp = (void *)(nd->nd_bpos);
 	nd->nd_mb->m_len += siz;

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Fri Jul  3 00:09:41 2020	(r362902)
+++ head/sys/fs/nfs/nfsport.h	Fri Jul  3 01:19:29 2020	(r362903)
@@ -109,8 +109,9 @@
 #include <ufs/ufs/ufsmount.h>
 #include <vm/uma.h>
 #include <vm/vm.h>
-#include <vm/vm_object.h>
 #include <vm/vm_extern.h>
+#include <vm/vm_object.h>
+#include <vm/vm_param.h>
 #include <nfs/nfssvc.h>
 #include "opt_nfs.h"
 #include "opt_ufs.h"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007030119.0631JTvr042079>