Remove references to vm_zone.h and switch over to the new uma API.

This commit is contained in:
Jeff Roberson 2002-03-20 10:07:52 +00:00
parent c526161420
commit ab426dc822
5 changed files with 28 additions and 28 deletions

View File

@ -122,9 +122,7 @@ MALLOC_DECLARE(M_NFSBIGFH);
MALLOC_DECLARE(M_NFSHASH);
#endif
#ifdef ZONE_INTERRUPT
extern vm_zone_t nfsmount_zone;
#endif
extern uma_zone_t nfsmount_zone;
extern struct callout_handle nfs_timer_handle;
extern struct nfsstats nfsstats;

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <vm/vm_zone.h>
#include <vm/uma.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfsnode.h>
#include <nfsclient/nfsmount.h>
static vm_zone_t nfsnode_zone;
static uma_zone_t nfsnode_zone;
static LIST_HEAD(nfsnodehashhead, nfsnode) *nfsnodehashtbl;
static u_long nfsnodehash;
static int nfs_node_hash_lock;
@ -154,7 +154,8 @@ void
nfs_nhinit(void)
{
nfsnode_zone = zinit("NFSNODE", sizeof(struct nfsnode), 0, 0, 1);
nfsnode_zone = uma_zcreate("NFSNODE", sizeof(struct nfsnode), NULL,
NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
nfsnodehashtbl = hashinit(desiredvnodes, M_NFSHASH, &nfsnodehash);
}
@ -220,7 +221,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp)
* might cause a bogus v_data pointer to get dereferenced
* elsewhere if zalloc should block.
*/
np = zalloc(nfsnode_zone);
np = uma_zalloc(nfsnode_zone, M_WAITOK);
error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp);
if (error) {
@ -228,7 +229,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp)
wakeup(&nfs_node_hash_lock);
nfs_node_hash_lock = 0;
*npp = 0;
zfree(nfsnode_zone, np);
uma_zfree(nfsnode_zone, np);
return (error);
}
vp = nvp;
@ -246,7 +247,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp)
if (nfs_node_hash_lock < 0)
wakeup(&nfs_node_hash_lock);
nfs_node_hash_lock = 0;
zfree(nfsnode_zone, np);
uma_zfree(nfsnode_zone, np);
goto retry;
}
LIST_INSERT_HEAD(nhpp, np, n_hash);
@ -352,7 +353,7 @@ nfs_reclaim(struct vop_reclaim_args *ap)
lockdestroy(&np->n_rslock);
cache_purge(vp);
zfree(nfsnode_zone, vp->v_data);
uma_zfree(nfsnode_zone, vp->v_data);
vp->v_data = (void *)0;
return (0);
}

View File

@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_zone.h>
#include <vm/uma.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
@ -388,7 +388,8 @@ nfs_init(struct vfsconf *vfsp)
{
int i;
nfsmount_zone = zinit("NFSMOUNT", sizeof(struct nfsmount), 0, 0, 1);
nfsmount_zone = uma_zcreate("NFSMOUNT", sizeof(struct nfsmount),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
rpc_vers = txdr_unsigned(RPC_VER2);
rpc_call = txdr_unsigned(RPC_CALL);
rpc_reply = txdr_unsigned(RPC_REPLY);

View File

@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_zone.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/route.h>
@ -78,7 +78,7 @@ MALLOC_DEFINE(M_NFSBIGFH, "NFSV3 bigfh", "NFS version 3 file handle");
MALLOC_DEFINE(M_NFSDIROFF, "NFSV3 diroff", "NFS directory offset data");
MALLOC_DEFINE(M_NFSHASH, "NFS hash", "NFS hash tables");
vm_zone_t nfsmount_zone;
uma_zone_t nfsmount_zone;
struct nfsstats nfsstats;
SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem");
@ -809,7 +809,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
FREE(nam, M_SONAME);
return (0);
} else {
nmp = zalloc(nfsmount_zone);
nmp = uma_zalloc(nfsmount_zone, M_WAITOK);
bzero((caddr_t)nmp, sizeof (struct nfsmount));
TAILQ_INIT(&nmp->nm_bufq);
mp->mnt_data = (qaddr_t)nmp;
@ -895,7 +895,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
bad:
nfs_disconnect(nmp);
crfree(nmp->nm_cred);
zfree(nfsmount_zone, nmp);
uma_zfree(nfsmount_zone, nmp);
FREE(nam, M_SONAME);
return (error);
}
@ -936,7 +936,7 @@ nfs_unmount(struct mount *mp, int mntflags, struct thread *td)
FREE(nmp->nm_nam, M_SONAME);
crfree(nmp->nm_cred);
zfree(nfsmount_zone, nmp);
uma_zfree(nfsmount_zone, nmp);
return (0);
}

View File

@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_zone.h>
#include <vm/uma.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
@ -605,7 +605,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
struct componentname *cnp = &ndp->ni_cnd;
*retdirp = (struct vnode *)0;
cnp->cn_pnbuf = zalloc(namei_zone);
cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK);
/*
* Copy the name from the mbuf list to ndp->ni_pnbuf
@ -670,7 +670,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
* Oh joy. For WebNFS, handle those pesky '%' escapes,
* and the 'native path' indicator.
*/
cp = zalloc(namei_zone);
cp = uma_zalloc(namei_zone, M_WAITOK);
fromcp = cnp->cn_pnbuf;
tocp = cp;
if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
@ -688,7 +688,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
*/
default:
error = EIO;
zfree(namei_zone, cp);
uma_zfree(namei_zone, cp);
goto out;
}
}
@ -704,14 +704,14 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
continue;
} else {
error = ENOENT;
zfree(namei_zone, cp);
uma_zfree(namei_zone, cp);
goto out;
}
} else
*tocp++ = *fromcp++;
}
*tocp = '\0';
zfree(namei_zone, cnp->cn_pnbuf);
uma_zfree(namei_zone, cnp->cn_pnbuf);
cnp->cn_pnbuf = cp;
}
@ -760,7 +760,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
if (cnp->cn_flags & (SAVENAME | SAVESTART))
cnp->cn_flags |= HASBUF;
else
zfree(namei_zone, cnp->cn_pnbuf);
uma_zfree(namei_zone, cnp->cn_pnbuf);
break;
}
@ -779,7 +779,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
goto badlink2;
}
if (ndp->ni_pathlen > 1)
cp = zalloc(namei_zone);
cp = uma_zalloc(namei_zone, M_WAITOK);
else
cp = cnp->cn_pnbuf;
aiov.iov_base = cp;
@ -795,7 +795,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
if (error) {
badlink1:
if (ndp->ni_pathlen > 1)
zfree(namei_zone, cp);
uma_zfree(namei_zone, cp);
badlink2:
vrele(ndp->ni_dvp);
vput(ndp->ni_vp);
@ -816,7 +816,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
*/
if (ndp->ni_pathlen > 1) {
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
zfree(namei_zone, cnp->cn_pnbuf);
uma_zfree(namei_zone, cnp->cn_pnbuf);
cnp->cn_pnbuf = cp;
} else
cnp->cn_pnbuf[linklen] = '\0';
@ -848,7 +848,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
*/
out:
if (error) {
zfree(namei_zone, cnp->cn_pnbuf);
uma_zfree(namei_zone, cnp->cn_pnbuf);
ndp->ni_vp = NULL;
ndp->ni_dvp = NULL;
ndp->ni_startdir = NULL;