Add support for ext_pgs mbufs to nfsrvd_rephead().

This is another in the 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.
This commit is contained in:
Rick Macklem 2020-07-07 00:42:23 +00:00
parent 2938ecc85c
commit 022346fa62

View File

@ -4443,21 +4443,30 @@ nfsrvd_rephead(struct nfsrv_descript *nd)
{
struct mbuf *mreq;
/*
* If this is a big reply, use a cluster.
*/
if ((nd->nd_flag & ND_GSSINITREPLY) == 0 &&
nfs_bigreply[nd->nd_procnum]) {
NFSMCLGET(mreq, M_WAITOK);
nd->nd_mreq = mreq;
nd->nd_mb = mreq;
if ((nd->nd_flag & ND_EXTPG) != 0) {
mreq = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK);
nd->nd_mreq = nd->nd_mb = mreq;
nd->nd_bpos = (char *)(void *)
PHYS_TO_DMAP(mreq->m_epg_pa[0]);
nd->nd_bextpg = 0;
nd->nd_bextpgsiz = PAGE_SIZE;
} else {
NFSMGET(mreq);
nd->nd_mreq = mreq;
nd->nd_mb = mreq;
/*
* If this is a big reply, use a cluster.
*/
if ((nd->nd_flag & ND_GSSINITREPLY) == 0 &&
nfs_bigreply[nd->nd_procnum]) {
NFSMCLGET(mreq, M_WAITOK);
nd->nd_mreq = mreq;
nd->nd_mb = mreq;
} else {
NFSMGET(mreq);
nd->nd_mreq = mreq;
nd->nd_mb = mreq;
}
nd->nd_bpos = mtod(mreq, char *);
mreq->m_len = 0;
}
nd->nd_bpos = mtod(mreq, caddr_t);
mreq->m_len = 0;
if ((nd->nd_flag & ND_GSSINITREPLY) == 0)
NFSM_BUILD(nd->nd_errp, int *, NFSX_UNSIGNED);