poolify nfsrv_descript.

This commit is contained in:
yamt 2003-05-22 14:16:23 +00:00
parent a423954d74
commit 85b757c497
4 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_socket.c,v 1.87 2003/05/22 14:11:50 yamt Exp $ */
/* $NetBSD: nfs_socket.c,v 1.88 2003/05/22 14:16:23 yamt Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.87 2003/05/22 14:11:50 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.88 2003/05/22 14:16:23 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -2174,15 +2174,14 @@ nfsrv_dorec(slp, nfsd, ndp)
nam->m_next = NULL;
} else
nam = NULL;
MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript),
M_NFSRVDESC, M_WAITOK);
nd = pool_get(&nfs_srvdesc_pool, PR_WAITOK);
nd->nd_md = nd->nd_mrep = m;
nd->nd_nam2 = nam;
nd->nd_dpos = mtod(m, caddr_t);
error = nfs_getreq(nd, nfsd, TRUE);
if (error) {
m_freem(nam);
FREE(nd, M_NFSRVDESC);
pool_put(&nfs_srvdesc_pool, nd);
return (error);
}
*ndp = nd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.120 2003/05/22 14:14:02 yamt Exp $ */
/* $NetBSD: nfs_subs.c,v 1.121 2003/05/22 14:16:23 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.120 2003/05/22 14:14:02 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.121 2003/05/22 14:16:23 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -1486,6 +1486,8 @@ nfs_init()
#ifdef NFSSERVER
nfsrv_init(0); /* Init server data structures */
nfsrv_initcache(); /* Init the server request cache */
pool_init(&nfs_srvdesc_pool, sizeof(struct nfsrv_descript),
0, 0, 0, "nfsrvdescpl", &pool_allocator_nointr);
#endif /* NFSSERVER */
#if defined(NFSSERVER) || !defined(NFS_V2_ONLY)

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_syscalls.c,v 1.63 2003/05/22 14:14:41 yamt Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.64 2003/05/22 14:16:23 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.63 2003/05/22 14:14:41 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.64 2003/05/22 14:16:23 yamt Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -344,7 +344,7 @@ sys_nfssvc(l, v, retval)
#ifdef NFSSERVER
MALLOC_DEFINE(M_NFSD, "NFS daemon", "Nfs server daemon structure");
MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure");
MALLOC_DEFINE(M_NFSRVDESC, "NFS srvdesc", "NFS server descriptor");
struct pool nfs_srvdesc_pool;
/*
* Adds a socket to the list for servicing by nfsds.
@ -545,7 +545,7 @@ nfssvc_nfsd(nsd, argp, l)
}
if (error || (slp->ns_flag & SLP_VALID) == 0) {
if (nd) {
FREE(nd, M_NFSRVDESC);
pool_put(&nfs_srvdesc_pool, nd);
nd = NULL;
}
nfsd->nfsd_slp = (struct nfssvc_sock *)0;
@ -724,7 +724,7 @@ nfssvc_nfsd(nsd, argp, l)
if (solockp)
nfs_sndunlock(solockp);
if (error == EINTR || error == ERESTART) {
FREE(nd, M_NFSRVDESC);
pool_put(&nfs_srvdesc_pool, nd);
nfsrv_slpderef(slp);
s = splsoftnet();
goto done;
@ -738,7 +738,7 @@ nfssvc_nfsd(nsd, argp, l)
break;
}
if (nd) {
FREE(nd, M_NFSRVDESC);
pool_put(&nfs_srvdesc_pool, nd);
nd = NULL;
}
@ -821,7 +821,7 @@ nfsrv_zapsock(slp)
for (nwp = LIST_FIRST(&slp->ns_tq); nwp; nwp = nnwp) {
nnwp = LIST_NEXT(nwp, nd_tq);
LIST_REMOVE(nwp, nd_tq);
FREE(nwp, M_NFSRVDESC);
pool_put(&nfs_srvdesc_pool, nwp);
}
LIST_INIT(&slp->ns_tq);
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_var.h,v 1.36 2003/05/22 14:14:03 yamt Exp $ */
/* $NetBSD: nfs_var.h,v 1.37 2003/05/22 14:16:24 yamt Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -42,15 +42,16 @@
#ifdef _KERNEL
#include <sys/mallocvar.h>
#include <sys/pool.h>
MALLOC_DECLARE(M_NFSREQ);
MALLOC_DECLARE(M_NFSMNT);
MALLOC_DECLARE(M_NFSUID);
MALLOC_DECLARE(M_NFSD);
MALLOC_DECLARE(M_NFSRVDESC);
MALLOC_DECLARE(M_NFSDIROFF);
MALLOC_DECLARE(M_NFSBIGFH);
MALLOC_DECLARE(M_NQLEASE);
extern struct pool nfs_srvdesc_pool;
struct vnode;
struct uio;