Add support for ext_pgs mbufs to nfscl_reqstart() and nfsm_set().
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:
parent
957a8d7e74
commit
dccb580624
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362917
@ -359,13 +359,19 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
|
|||||||
/*
|
/*
|
||||||
* Get the first mbuf for the request.
|
* Get the first mbuf for the request.
|
||||||
*/
|
*/
|
||||||
if (nfs_bigrequest[procnum])
|
if ((nd->nd_flag & ND_EXTPG) != 0) {
|
||||||
NFSMCLGET(mb, M_WAITOK);
|
mb = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK);
|
||||||
else
|
nd->nd_mreq = nd->nd_mb = mb;
|
||||||
NFSMGET(mb);
|
nfsm_set(nd, 0);
|
||||||
mb->m_len = 0;
|
} else {
|
||||||
nd->nd_mreq = nd->nd_mb = mb;
|
if (nfs_bigrequest[procnum])
|
||||||
nd->nd_bpos = mtod(mb, char *);
|
NFSMCLGET(mb, M_WAITOK);
|
||||||
|
else
|
||||||
|
NFSMGET(mb);
|
||||||
|
mb->m_len = 0;
|
||||||
|
nd->nd_mreq = nd->nd_mb = mb;
|
||||||
|
nd->nd_bpos = mtod(mb, char *);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* And fill the first file handle into the request.
|
* And fill the first file handle into the request.
|
||||||
@ -4804,7 +4810,38 @@ void
|
|||||||
nfsm_set(struct nfsrv_descript *nd, u_int offs)
|
nfsm_set(struct nfsrv_descript *nd, u_int offs)
|
||||||
{
|
{
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
int rlen;
|
||||||
|
|
||||||
m = nd->nd_mb;
|
m = nd->nd_mb;
|
||||||
nd->nd_bpos = mtod(m, char *) + offs;
|
if ((m->m_flags & M_EXTPG) != 0) {
|
||||||
|
nd->nd_bextpg = 0;
|
||||||
|
while (offs > 0) {
|
||||||
|
if (nd->nd_bextpg == 0)
|
||||||
|
rlen = m_epg_pagelen(m, 0, m->m_epg_1st_off);
|
||||||
|
else
|
||||||
|
rlen = m_epg_pagelen(m, nd->nd_bextpg, 0);
|
||||||
|
if (offs <= rlen)
|
||||||
|
break;
|
||||||
|
offs -= rlen;
|
||||||
|
nd->nd_bextpg++;
|
||||||
|
if (nd->nd_bextpg == m->m_epg_npgs) {
|
||||||
|
printf("nfsm_set: build offs "
|
||||||
|
"out of range\n");
|
||||||
|
nd->nd_bextpg--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nd->nd_bpos = (char *)(void *)
|
||||||
|
PHYS_TO_DMAP(m->m_epg_pa[nd->nd_bextpg]);
|
||||||
|
if (nd->nd_bextpg == 0)
|
||||||
|
nd->nd_bpos += m->m_epg_1st_off;
|
||||||
|
if (offs > 0) {
|
||||||
|
nd->nd_bpos += offs;
|
||||||
|
nd->nd_bextpgsiz = rlen - offs;
|
||||||
|
} else if (nd->nd_bextpg == 0)
|
||||||
|
nd->nd_bextpgsiz = PAGE_SIZE - m->m_epg_1st_off;
|
||||||
|
else
|
||||||
|
nd->nd_bextpgsiz = PAGE_SIZE;
|
||||||
|
} else
|
||||||
|
nd->nd_bpos = mtod(m, char *) + offs;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user