svn commit: r360945 - in projects/nfs-over-tls/sys/fs: nfs nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Tue May 12 00:36:38 UTC 2020
Author: rmacklem
Date: Tue May 12 00:36:37 2020
New Revision: 360945
URL: https://svnweb.freebsd.org/changeset/base/360945
Log:
Get rid of some more of the dissect code for ext_pgs mbufs.
Modified:
projects/nfs-over-tls/sys/fs/nfs/nfs_commonport.c
projects/nfs-over-tls/sys/fs/nfs/nfs_var.h
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_commonport.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfs/nfs_commonport.c Mon May 11 22:57:21 2020 (r360944)
+++ projects/nfs-over-tls/sys/fs/nfs/nfs_commonport.c Tue May 12 00:36:37 2020 (r360945)
@@ -183,34 +183,8 @@ newnfs_realign(struct mbuf **pm, int how)
{
struct mbuf *m, *n;
int off, space;
- bool copyit;
++nfs_realign_test;
-
- /*
- * For ext_pgs mbufs, just copy the entire chain if there is an
- * alignment problem.
- */
- copyit = false;
- m = *pm;
- while ((m->m_flags & M_NOMAP) != 0) {
- if ((m->m_len & 0x3) != 0 ||
- (m->m_ext_pgs.first_pg_off & 0x3) != 0) {
- copyit = true;
- break;
- }
- m = m->m_next;
- if (m == NULL)
- return (0);
- }
- if (copyit) {
- m = mb_unmapped_to_ext(*pm);
- if (m == NULL)
- return (ENOMEM);
- *pm = m;
- return (0);
- }
-
while ((m = *pm) != NULL) {
if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) {
/*
Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfs/nfs_var.h Mon May 11 22:57:21 2020 (r360944)
+++ projects/nfs-over-tls/sys/fs/nfs/nfs_var.h Tue May 12 00:36:37 2020 (r360945)
@@ -750,7 +750,7 @@ int nfsvno_allocate(struct vnode *, off_t, off_t, stru
int nfsvno_getxattr(struct vnode *, char *, uint32_t, struct ucred *,
uint64_t, int, struct thread *, struct mbuf **, struct mbuf **, int *);
int nfsvno_setxattr(struct vnode *, char *, int, struct mbuf *, char *,
- int, int, struct ucred *, struct thread *);
+ struct ucred *, struct thread *);
int nfsvno_rmxattr(struct nfsrv_descript *, struct vnode *, char *,
struct ucred *, struct thread *);
int nfsvno_listxattr(struct vnode *, uint64_t, struct ucred *, struct thread *,
Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Mon May 11 22:57:21 2020 (r360944)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Tue May 12 00:36:37 2020 (r360945)
@@ -114,8 +114,6 @@ static int nfsrv_createiovec_extpgs(int, int, struct m
struct mbuf **, struct iovec **);
static int nfsrv_createiovecw(int, struct mbuf *, char *, struct iovec **,
int *);
-static int nfsrv_createiovecw_extpgs(int, struct mbuf *, char *, int,
- int, struct iovec **, int *);
static void nfsrv_pnfscreate(struct vnode *, struct vattr *, struct ucred *,
NFSPROC_T *);
static void nfsrv_pnfsremovesetup(struct vnode *, NFSPROC_T *, struct vnode **,
@@ -1032,92 +1030,6 @@ nfsrv_createiovecw(int retlen, struct mbuf *m, char *c
}
/*
- * Create the iovec for the mbuf chain passed in as an argument.
- * The "cp" argument is where the data starts within the first mbuf in
- * the chain. It returns the iovec and the iovcnt.
- * Same as above, but for ext_pgs mbufs.
- */
-static int
-nfsrv_createiovecw_extpgs(int retlen, struct mbuf *m, char *cp, int dextpg,
- int dextpgsiz, struct iovec **ivpp, int *iovcntp)
-{
- struct mbuf *mp;
- struct mbuf_ext_pgs *pgs;
- struct iovec *ivp;
- int cnt, i, len, pgno;
-
- /*
- * Loop through the mbuf chain, counting how many pages are
- * part of this write oepration, so the iovec size is known.
- */
- cnt = 0;
- len = retlen;
- mp = m;
- pgs = &mp->m_ext_pgs;
- i = dextpgsiz;
- pgno = dextpg;
- while (len > 0) {
- if (i > 0) {
- len -= i;
- cnt++;
- }
- if (len > 0) {
- if (pgno == pgs->npgs - 1) {
- mp = mp->m_next;
- if (mp == NULL)
- return (EBADRPC);
- pgno = 0;
- pgs = &mp->m_ext_pgs;
- } else
- pgno++;
- if (pgno == 0)
- i = mbuf_ext_pg_len(pgs, 0,
- pgs->first_pg_off);
- else
- i = mbuf_ext_pg_len(pgs, pgno, 0);
- }
- }
-
- /* Now, create the iovec. */
- mp = m;
- *ivpp = ivp = malloc(cnt * sizeof (struct iovec), M_TEMP,
- M_WAITOK);
- *iovcntp = cnt;
- len = retlen;
- pgs = &mp->m_ext_pgs;
- i = dextpgsiz;
- pgno = dextpg;
- while (len > 0) {
- if (i > 0) {
- i = min(i, len);
- ivp->iov_base = cp;
- ivp->iov_len = i;
- ivp++;
- len -= i;
- }
- if (len > 0) {
- if (pgno == pgs->npgs - 1) {
- mp = mp->m_next;
- if (mp == NULL)
- return (EBADRPC);
- pgno = 0;
- pgs = &mp->m_ext_pgs;
- } else
- pgno++;
- cp = (char *)(void *)
- PHYS_TO_DMAP(mp->m_epg_pa[pgno]);
- if (pgno == 0) {
- cp += pgs->first_pg_off;
- i = mbuf_ext_pg_len(pgs, 0,
- pgs->first_pg_off);
- } else
- i = mbuf_ext_pg_len(pgs, pgno, 0);
- }
- }
- return (0);
-}
-
-/*
* Write vnode op from an mbuf list.
*/
int
@@ -6435,8 +6347,7 @@ out:
*/
int
nfsvno_setxattr(struct vnode *vp, char *name, int len, struct mbuf *m,
- char *cp, int dextpg, int dextpgsiz, struct ucred *cred,
- struct thread *p)
+ char *cp, struct ucred *cred, struct thread *p)
{
struct iovec *iv;
struct uio uio, *uiop = &uio;
@@ -6455,11 +6366,7 @@ nfsvno_setxattr(struct vnode *vp, char *name, int len,
uiop->uio_td = p;
uiop->uio_offset = 0;
uiop->uio_resid = len;
- if ((m->m_flags & M_NOMAP) != 0)
- error = nfsrv_createiovecw_extpgs(len, m, cp, dextpg,
- dextpgsiz, &iv, &cnt);
- else
- error = nfsrv_createiovecw(len, m, cp, &iv, &cnt);
+ error = nfsrv_createiovecw(len, m, cp, &iv, &cnt);
uiop->uio_iov = iv;
uiop->uio_iovcnt = cnt;
if (error == 0) {
Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c Mon May 11 22:57:21 2020 (r360944)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdserv.c Tue May 12 00:36:37 2020 (r360945)
@@ -5708,8 +5708,7 @@ nfsrvd_setxattr(struct nfsrv_descript *nd, __unused in
nd->nd_repstat = nfsvno_getattr(vp, &ova, nd, p, 1, &attrbits);
if (nd->nd_repstat == 0) {
nd->nd_repstat = nfsvno_setxattr(vp, name, len, nd->nd_md,
- nd->nd_dpos, nd->nd_dextpg, nd->nd_dextpgsiz, nd->nd_cred,
- p);
+ nd->nd_dpos, nd->nd_cred, p);
if (nd->nd_repstat == ENXIO)
nd->nd_repstat = NFSERR_XATTR2BIG;
}
More information about the svn-src-projects
mailing list