From owner-svn-src-projects@freebsd.org Sun Jun 7 03:11:36 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3561347A12 for ; Sun, 7 Jun 2020 03:11:36 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fhHX4r7kz4c2H; Sun, 7 Jun 2020 03:11:36 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A145BCC12; Sun, 7 Jun 2020 03:11:36 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0573BaiW012537; Sun, 7 Jun 2020 03:11:36 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0573BZL1012530; Sun, 7 Jun 2020 03:11:35 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202006070311.0573BZL1012530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 7 Jun 2020 03:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r361883 - in projects/nfs-over-tls/sys: fs/nfs fs/nfsclient fs/nfsserver kern rpc sys X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/nfs-over-tls/sys: fs/nfs fs/nfsclient fs/nfsserver kern rpc sys X-SVN-Commit-Revision: 361883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2020 03:11:36 -0000 Author: rmacklem Date: Sun Jun 7 03:11:34 2020 New Revision: 361883 URL: https://svnweb.freebsd.org/changeset/base/361883 Log: Simplify the functions added to kern_mbuf.c by removing the ext_free argument, since they always use anonymous pages. Also, remove mb_splitatpos_ext(), since it is no longer used. Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c projects/nfs-over-tls/sys/fs/nfs/nfsm_subs.h projects/nfs-over-tls/sys/fs/nfsclient/nfs_clcomsubs.c projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c projects/nfs-over-tls/sys/kern/kern_mbuf.c projects/nfs-over-tls/sys/rpc/rpc_generic.c projects/nfs-over-tls/sys/sys/mbuf.h Modified: projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/fs/nfs/nfs_commonsubs.c Sun Jun 7 03:11:34 2020 (r361883) @@ -375,8 +375,7 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, * Get the first mbuf for the request. */ if ((nd->nd_flag & ND_EXTPG) != 0) { - mb = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK, - mb_free_mext_pgs); + mb = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); nd->nd_mreq = nd->nd_mb = mb; nfsm_set(nd, 0); } else { @@ -4465,8 +4464,7 @@ nfsrvd_rephead(struct nfsrv_descript *nd) struct mbuf *mreq; if ((nd->nd_flag & ND_EXTPG) != 0) { - mreq = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK, - mb_free_mext_pgs); + 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]); @@ -4918,8 +4916,7 @@ nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *b vm_page_t pg; if ((m->m_epg_npgs + 1) * PAGE_SIZE > maxextsiz) { - mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK, - mb_free_mext_pgs); + mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); *bextpg = 0; m->m_next = mp; } else { Modified: projects/nfs-over-tls/sys/fs/nfs/nfsm_subs.h ============================================================================== --- projects/nfs-over-tls/sys/fs/nfs/nfsm_subs.h Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/fs/nfs/nfsm_subs.h Sun Jun 7 03:11:34 2020 (r361883) @@ -75,8 +75,7 @@ nfsm_build(struct nfsrv_descript *nd, int siz) 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, - mb_free_mext_pgs); + 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; Modified: projects/nfs-over-tls/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfsclient/nfs_clcomsubs.c Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/fs/nfsclient/nfs_clcomsubs.c Sun Jun 7 03:11:34 2020 (r361883) @@ -183,8 +183,7 @@ nfsm_uiombuflist(bool doextpgs, int maxextsiz, struct clflg = 0; rem = NFSM_RNDUP(siz) - siz; if (doextpgs) { - mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK, - mb_free_mext_pgs); + mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); mcp = (char *)(void *) PHYS_TO_DMAP(mp->m_epg_pa[0]); bextpgsiz = PAGE_SIZE; Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdport.c Sun Jun 7 03:11:34 2020 (r361883) @@ -860,8 +860,7 @@ nfsrv_createiovec_extpgs(int len, int maxextsiz, struc i = 0; while (left > 0) { siz = min(left, maxextsiz); - m = mb_alloc_ext_plus_pages(siz, M_WAITOK, - mb_free_mext_pgs); + m = mb_alloc_ext_plus_pages(siz, M_WAITOK); left -= siz; i += m->m_epg_npgs; if (m3 != NULL) Modified: projects/nfs-over-tls/sys/kern/kern_mbuf.c ============================================================================== --- projects/nfs-over-tls/sys/kern/kern_mbuf.c Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/kern/kern_mbuf.c Sun Jun 7 03:11:34 2020 (r361883) @@ -1543,13 +1543,13 @@ m_snd_tag_destroy(struct m_snd_tag *mst) * Allocate an mbuf with anonymous external pages. */ struct mbuf * -mb_alloc_ext_plus_pages(int len, int how, m_ext_free_t ext_free) +mb_alloc_ext_plus_pages(int len, int how) { struct mbuf *m; vm_page_t pg; int i, npgs; - m = mb_alloc_ext_pgs(how, ext_free); + m = mb_alloc_ext_pgs(how, mb_free_mext_pgs); if (m == NULL) return (NULL); m->m_epg_flags |= EPG_FLAG_ANON; @@ -1574,13 +1574,14 @@ mb_alloc_ext_plus_pages(int len, int how, m_ext_free_t } /* - * Copy the data in the mbuf chain to a chain of mbufs with external pages. + * Copy the data in the mbuf chain to a chain of mbufs with anonymous external + * unmapped pages. * len is the length of data in the input mbuf chain. * mlen is the maximum number of bytes put into each ext_page mbuf. */ struct mbuf * -mb_copym_ext_pgs(struct mbuf *mp, int len, int mlen, int how, - m_ext_free_t ext_free, struct mbuf **mlast) +mb_mapped_to_unmapped(struct mbuf *mp, int len, int mlen, int how, + struct mbuf **mlast) { struct mbuf *m, *mout = NULL; char *pgpos = NULL, *mbpos; @@ -1596,13 +1597,13 @@ mb_copym_ext_pgs(struct mbuf *mp, int len, int mlen, i mbufsiz = min(mlen, len); if (m == NULL) { m = mout = mb_alloc_ext_plus_pages( - mbufsiz, how, ext_free); + mbufsiz, how); if (m == NULL) return (m); } else { m->m_epg_last_len = PAGE_SIZE; m->m_next = mb_alloc_ext_plus_pages( - mbufsiz, how, ext_free); + mbufsiz, how); m = m->m_next; if (m == NULL) { m_freem(mout); @@ -1639,116 +1640,4 @@ mb_copym_ext_pgs(struct mbuf *mp, int len, int mlen, i if (mlast != NULL) *mlast = m; return (mout); -} - -/* - * Split an ext_pgs mbuf list into two lists at len bytes. - * Similar to m_split(), but for ext_pgs mbufs with - * anonymous pages. - */ -struct mbuf * -mb_splitatpos_ext(struct mbuf *m0, int len, int how) -{ - struct mbuf *m, *mp; - vm_page_t pg; - int i, j, left, pgno, plen, trim; - char *cp, *cp0; - - /* Nothing to do. */ - if (len == 0) - return (NULL); - - /* Find the correct mbuf to split at. */ - for (mp = m0; mp != NULL && len > mp->m_len; mp = mp->m_next) - len -= mp->m_len; - if (mp == NULL) - return (NULL); - - /* If len == mp->m_len, we can just split the mbuf list. */ - if (len == mp->m_len) { - m = mp->m_next; - mp->m_next = NULL; - return (m); - } - - /* Find the page to split at. */ - KASSERT((mp->m_flags & (M_EXT | M_EXTPG)) == - (M_EXT | M_EXTPG), - ("mb_splitatpos_ext: m0 not ext_pgs")); - KASSERT((mp->m_epg_flags & EPG_FLAG_ANON) != 0, - ("mb_splitatpos_ext: not anonymous pages")); - pgno = 0; - left = len; - do { - if (pgno == 0) - plen = m_epg_pagelen(mp, 0, mp->m_epg_1st_off); - else - plen = m_epg_pagelen(mp, pgno, 0); - if (left <= plen) - break; - left -= plen; - pgno++; - } while (pgno < mp->m_epg_npgs); - if (pgno == mp->m_epg_npgs) - panic("mb_splitatpos_ext"); - mp->m_len = len; - - m = mb_alloc_ext_pgs(how, mb_free_mext_pgs); - if (m == NULL) - return (NULL); - m->m_epg_flags |= EPG_FLAG_ANON; - - /* - * If left < plen, allocate a new page for the new mbuf - * and copy the data after left in the page to this new - * page. - */ - if (left < plen) { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) { - if (how == M_NOWAIT) { - m_free(m); - return (NULL); - } - vm_wait(NULL); - } - } while (pg == NULL); - m->m_epg_pa[0] = VM_PAGE_TO_PHYS(pg); - m->m_epg_npgs++; - trim = plen - left; - cp = (char *)(void *)PHYS_TO_DMAP(mp->m_epg_pa[pgno]); - cp0 = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[0]); - if (pgno == 0) - cp += mp->m_epg_1st_off; - cp += left; - if (pgno == mp->m_epg_npgs - 1) - m->m_epg_last_len = trim; - else { - m->m_epg_last_len = mp->m_epg_last_len; - m->m_epg_1st_off = PAGE_SIZE - trim; - cp0 += PAGE_SIZE - trim; - } - memcpy(cp0, cp, trim); - m->m_len = trim; - } else - m->m_epg_last_len = mp->m_epg_last_len; - - /* Move the pages beyond pgno to the new mbuf. */ - for (i = pgno + 1, j = m->m_epg_npgs; i < mp->m_epg_npgs; i++, j++) { - m->m_epg_pa[j] = mp->m_epg_pa[i]; - /* Never moves page 0. */ - m->m_len += m_epg_pagelen(mp, i, 0); - } - m->m_epg_npgs = j; - mp->m_epg_npgs = pgno + 1; - - /* Can now update mp->m_epg_last_len. */ - mp->m_epg_last_len = left; - - m->m_next = mp->m_next; - mp->m_next = NULL; - return (m); } Modified: projects/nfs-over-tls/sys/rpc/rpc_generic.c ============================================================================== --- projects/nfs-over-tls/sys/rpc/rpc_generic.c Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/rpc/rpc_generic.c Sun Jun 7 03:11:34 2020 (r361883) @@ -912,8 +912,8 @@ _rpc_copym_into_ext_pgs(struct mbuf *mp, int maxextsiz * mbuf list. */ m2->m_next = NULL; - mhead = mb_copym_ext_pgs(mp, tlen, maxextsiz, M_WAITOK, - mb_free_mext_pgs, &m2); + mhead = mb_mapped_to_unmapped(mp, tlen, maxextsiz, + M_WAITOK, &m2); /* * Link the ext_pgs list onto the newly copied Modified: projects/nfs-over-tls/sys/sys/mbuf.h ============================================================================== --- projects/nfs-over-tls/sys/sys/mbuf.h Sun Jun 7 02:40:21 2020 (r361882) +++ projects/nfs-over-tls/sys/sys/mbuf.h Sun Jun 7 03:11:34 2020 (r361883) @@ -741,10 +741,9 @@ void mb_free_ext(struct mbuf *); void mb_free_extpg(struct mbuf *); void mb_free_mext_pgs(struct mbuf *); struct mbuf *mb_alloc_ext_pgs(int, m_ext_free_t); -struct mbuf *mb_alloc_ext_plus_pages(int, int, m_ext_free_t); -struct mbuf *mb_copym_ext_pgs(struct mbuf *, int, int, int, - m_ext_free_t, struct mbuf **); -struct mbuf *mb_splitatpos_ext(struct mbuf *, int, int); +struct mbuf *mb_alloc_ext_plus_pages(int, int); +struct mbuf *mb_mapped_to_unmapped(struct mbuf *, int, int, int, + struct mbuf **); int mb_unmapped_compress(struct mbuf *m); struct mbuf *mb_unmapped_to_ext(struct mbuf *m); void mb_free_notready(struct mbuf *m, int count);