More LIST/CIRCLEQ migration.
This commit is contained in:
parent
92da9d2f33
commit
f7c13d44bd
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs.h,v 1.6 1994/08/17 14:43:47 mycroft Exp $ */
|
||||
/* $NetBSD: nfs.h,v 1.7 1994/08/18 22:47:43 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -193,7 +193,7 @@ struct nfsreq {
|
||||
/*
|
||||
* Queue head for nfsreq's
|
||||
*/
|
||||
TAILQ_HEAD(nfsreqs, nfsreq) nfs_reqq;
|
||||
TAILQ_HEAD(, nfsreq) nfs_reqq;
|
||||
|
||||
/* Flag values for r_flags */
|
||||
#define R_TIMING 0x01 /* timing request (in mntp) */
|
||||
@ -241,8 +241,8 @@ struct nfsuid {
|
||||
|
||||
struct nfssvc_sock {
|
||||
TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
|
||||
TAILQ_HEAD(nfsuidlru, nfsuid) ns_uidlruhead;
|
||||
LIST_HEAD(nfsuidhash, nfsuid) *ns_uidhashtbl;
|
||||
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
|
||||
LIST_HEAD(, nfsuid) *ns_uidhashtbl;
|
||||
u_long ns_uidhash;
|
||||
|
||||
int ns_flag;
|
||||
@ -268,7 +268,7 @@ struct nfssvc_sock {
|
||||
#define SLP_GETSTREAM 0x10
|
||||
#define SLP_ALLFLAGS 0xff
|
||||
|
||||
TAILQ_HEAD(nfssvc_socks, nfssvc_sock) nfssvc_sockhead;
|
||||
TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead;
|
||||
int nfssvc_sockhead_flag;
|
||||
#define SLP_INIT 0x01
|
||||
#define SLP_WANTINIT 0x02
|
||||
@ -301,7 +301,7 @@ struct nfsd {
|
||||
#define NFSD_NEEDAUTH 0x04
|
||||
#define NFSD_AUTHFAIL 0x08
|
||||
|
||||
TAILQ_HEAD(nfsds, nfsd) nfsd_head;
|
||||
TAILQ_HEAD(, nfsd) nfsd_head;
|
||||
int nfsd_head_flag;
|
||||
#define NFSD_CHECKSLP 0x01
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_node.c,v 1.12 1994/06/29 06:42:09 cgd Exp $ */
|
||||
/* $NetBSD: nfs_node.c,v 1.13 1994/08/18 22:47:46 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -54,9 +54,10 @@
|
||||
#include <nfs/nfsmount.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
|
||||
struct nfsnode **nheadhashtbl;
|
||||
u_long nheadhash;
|
||||
#define NFSNOHASH(fhsum) ((fhsum)&nheadhash)
|
||||
#define NFSNOHASH(fhsum) \
|
||||
(&nfsnodehashtbl[(fhsum) & nfsnodehash])
|
||||
LIST_HEAD(nfsnodehashhead, nfsnode) *nfsnodehashtbl;
|
||||
u_long nfsnodehash;
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
@ -72,13 +73,13 @@ nfs_nhinit()
|
||||
if ((sizeof(struct nfsnode) - 1) & sizeof(struct nfsnode))
|
||||
printf("nfs_nhinit: bad size %d\n", sizeof(struct nfsnode));
|
||||
#endif /* not lint */
|
||||
nheadhashtbl = hashinit(desiredvnodes, M_NFSNODE, &nheadhash);
|
||||
nfsnodehashtbl = hashinit(desiredvnodes, M_NFSNODE, &nfsnodehash);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute an entry in the NFS hash table structure
|
||||
*/
|
||||
struct nfsnode **
|
||||
struct nfsnodehashhead *
|
||||
nfs_hash(fhp)
|
||||
register nfsv2fh_t *fhp;
|
||||
{
|
||||
@ -90,7 +91,7 @@ nfs_hash(fhp)
|
||||
fhsum = 0;
|
||||
for (i = 0; i < NFSX_FH; i++)
|
||||
fhsum += *fhpp++;
|
||||
return (&nheadhashtbl[NFSNOHASH(fhsum)]);
|
||||
return (NFSNOHASH(fhsum));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -104,7 +105,8 @@ nfs_nget(mntp, fhp, npp)
|
||||
register nfsv2fh_t *fhp;
|
||||
struct nfsnode **npp;
|
||||
{
|
||||
register struct nfsnode *np, *nq, **nhpp;
|
||||
register struct nfsnode *np;
|
||||
struct nfsnodehashhead *nhpp;
|
||||
register struct vnode *vp;
|
||||
extern int (**nfsv2_vnodeop_p)();
|
||||
struct vnode *nvp;
|
||||
@ -112,7 +114,7 @@ nfs_nget(mntp, fhp, npp)
|
||||
|
||||
nhpp = nfs_hash(fhp);
|
||||
loop:
|
||||
for (np = *nhpp; np; np = np->n_forw) {
|
||||
for (np = nhpp->lh_first; np != 0; np = np->n_hash.le_next) {
|
||||
if (mntp != NFSTOV(np)->v_mount ||
|
||||
bcmp((caddr_t)fhp, (caddr_t)&np->n_fh, NFSX_FH))
|
||||
continue;
|
||||
@ -134,11 +136,7 @@ loop:
|
||||
* Insert the nfsnode in the hash queue for its new file handle
|
||||
*/
|
||||
np->n_flag = 0;
|
||||
if (nq = *nhpp)
|
||||
nq->n_back = &np->n_forw;
|
||||
np->n_forw = nq;
|
||||
np->n_back = nhpp;
|
||||
*nhpp = np;
|
||||
LIST_INSERT_HEAD(nhpp, np, n_hash);
|
||||
bcopy((caddr_t)fhp, (caddr_t)&np->n_fh, NFSX_FH);
|
||||
np->n_attrstamp = 0;
|
||||
np->n_direofoffset = 0;
|
||||
@ -150,7 +148,7 @@ loop:
|
||||
np->n_brev = 0;
|
||||
np->n_lrev = 0;
|
||||
np->n_expiry = (time_t)0;
|
||||
np->n_tnext = (struct nfsnode *)0;
|
||||
np->n_timer.cqe_next = (struct nfsnode *)0;
|
||||
}
|
||||
*npp = np;
|
||||
return (0);
|
||||
@ -199,30 +197,17 @@ nfs_reclaim(ap)
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register struct nfsmount *nmp = VFSTONFS(vp->v_mount);
|
||||
register struct nfsnode *nq;
|
||||
extern int prtactive;
|
||||
|
||||
if (prtactive && vp->v_usecount != 0)
|
||||
vprint("nfs_reclaim: pushing active", vp);
|
||||
/*
|
||||
* Remove the nfsnode from its hash chain.
|
||||
*/
|
||||
if (nq = np->n_forw)
|
||||
nq->n_back = np->n_back;
|
||||
*np->n_back = nq;
|
||||
LIST_REMOVE(np, n_hash);
|
||||
|
||||
/*
|
||||
* For nqnfs, take it off the timer queue as required.
|
||||
*/
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && np->n_tnext) {
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np->n_tprev;
|
||||
else
|
||||
np->n_tnext->n_tprev = np->n_tprev;
|
||||
if (np->n_tprev == (struct nfsnode *)nmp)
|
||||
nmp->nm_tnext = np->n_tnext;
|
||||
else
|
||||
np->n_tprev->n_tnext = np->n_tnext;
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && np->n_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
}
|
||||
cache_purge(vp);
|
||||
FREE(vp->v_data, M_NFSNODE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.4 1994/08/17 14:43:49 mycroft Exp $ */
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.5 1994/08/18 22:47:49 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -75,15 +75,6 @@
|
||||
#include <nfs/nfsnode.h>
|
||||
#include <nfs/nfsmount.h>
|
||||
|
||||
/*
|
||||
* List head for the lease queue and other global data.
|
||||
* At any time a lease is linked into a list ordered by increasing expiry time.
|
||||
*/
|
||||
#define NQFHHASH(f) ((*((u_long *)(f)))&nqfheadhash)
|
||||
|
||||
union nqsrvthead nqthead;
|
||||
struct nqlease **nqfhead;
|
||||
u_long nqfheadhash;
|
||||
time_t nqnfsstarttime = (time_t)0;
|
||||
u_long nqnfs_prog, nqnfs_vers;
|
||||
int nqsrv_clockskew = NQ_CLOCKSKEW;
|
||||
@ -125,8 +116,6 @@ int nqnfs_piggy[NFS_NPROCS] = {
|
||||
0,
|
||||
};
|
||||
|
||||
int nnnnnn = sizeof (struct nqlease);
|
||||
int oooooo = sizeof (struct nfsnode);
|
||||
extern nfstype nfs_type[9];
|
||||
extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
extern int nfsd_waiting;
|
||||
@ -167,7 +156,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
u_quad_t *frev;
|
||||
struct ucred *cred;
|
||||
{
|
||||
register struct nqlease *lp, *lq, **lpp;
|
||||
register struct nqlease *lp;
|
||||
register struct nqfhhashhead *lpp;
|
||||
register struct nqhost *lph;
|
||||
struct nqlease *tlp;
|
||||
struct nqm **lphp;
|
||||
@ -186,8 +176,7 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
tlp = vp->v_lease;
|
||||
if ((flags & NQL_CHECK) == 0)
|
||||
nfsstats.srvnqnfs_getleases++;
|
||||
if (tlp == (struct nqlease *)0) {
|
||||
|
||||
if (tlp == 0) {
|
||||
/*
|
||||
* Find the lease by searching the hash list.
|
||||
*/
|
||||
@ -196,8 +185,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
lpp = &nqfhead[NQFHHASH(fh.fh_fid.fid_data)];
|
||||
for (lp = *lpp; lp; lp = lp->lc_fhnext)
|
||||
lpp = NQFHHASH(fh.fh_fid.fid_data);
|
||||
for (lp = lpp->lh_first; lp != 0; lp = lp->lc_hash.le_next)
|
||||
if (fh.fh_fsid.val[0] == lp->lc_fsid.val[0] &&
|
||||
fh.fh_fsid.val[1] == lp->lc_fsid.val[1] &&
|
||||
!bcmp(fh.fh_fid.fid_data, lp->lc_fiddata,
|
||||
@ -208,14 +197,14 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
tlp = lp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
lp = tlp;
|
||||
if (lp) {
|
||||
} else
|
||||
lp = tlp;
|
||||
if (lp != 0) {
|
||||
if ((lp->lc_flag & LC_NONCACHABLE) ||
|
||||
(lp->lc_morehosts == (struct nqm *)0 &&
|
||||
nqsrv_cmpnam(nd->nd_slp, nam, &lp->lc_host)))
|
||||
goto doreply;
|
||||
if ((flags & NQL_READ) && (lp->lc_flag & LC_WRITE)==0) {
|
||||
if ((flags & NQL_READ) && (lp->lc_flag & LC_WRITE) == 0) {
|
||||
if (flags & NQL_CHECK)
|
||||
goto doreply;
|
||||
if (nqsrv_cmpnam(nd->nd_slp, nam, &lp->lc_host))
|
||||
@ -299,11 +288,7 @@ doreply:
|
||||
lp->lc_vp = vp;
|
||||
lp->lc_fsid = fh.fh_fsid;
|
||||
bcopy(fh.fh_fid.fid_data, lp->lc_fiddata, fh.fh_fid.fid_len - sizeof (long));
|
||||
if (lq = *lpp)
|
||||
lq->lc_fhprev = &lp->lc_fhnext;
|
||||
lp->lc_fhnext = lq;
|
||||
lp->lc_fhprev = lpp;
|
||||
*lpp = lp;
|
||||
LIST_INSERT_HEAD(lpp, lp, lc_hash);
|
||||
vp->v_lease = lp;
|
||||
s = splsoftclock();
|
||||
nqsrv_instimeq(lp, *duration);
|
||||
@ -377,19 +362,24 @@ nqsrv_instimeq(lp, duration)
|
||||
newexpiry = time.tv_sec + duration + nqsrv_clockskew;
|
||||
if (lp->lc_expiry == newexpiry)
|
||||
return;
|
||||
if (lp->lc_chain1[0])
|
||||
remque(lp);
|
||||
if (lp->lc_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
}
|
||||
lp->lc_expiry = newexpiry;
|
||||
|
||||
/*
|
||||
* Find where in the queue it should be.
|
||||
*/
|
||||
tlp = nqthead.th_chain[1];
|
||||
while (tlp->lc_expiry > newexpiry && tlp != (struct nqlease *)&nqthead)
|
||||
tlp = tlp->lc_chain1[1];
|
||||
if (tlp == nqthead.th_chain[1])
|
||||
tlp = nqtimerhead.cqh_last;
|
||||
while (tlp != (void *)&nqtimerhead && tlp->lc_expiry > newexpiry)
|
||||
tlp = tlp->lc_timer.cqe_prev;
|
||||
if (tlp == nqtimerhead.cqh_last)
|
||||
NQSTORENOVRAM(newexpiry);
|
||||
insque(lp, tlp);
|
||||
if (tlp == (void *)&nqtimerhead) {
|
||||
CIRCLEQ_INSERT_HEAD(&nqtimerhead, lp, lc_timer);
|
||||
} else {
|
||||
CIRCLEQ_INSERT_AFTER(&nqtimerhead, tlp, lp, lc_timer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -602,11 +592,11 @@ nqnfs_serverd()
|
||||
struct mbuf *n;
|
||||
int i, len, ok;
|
||||
|
||||
lp = nqthead.th_chain[0];
|
||||
while (lp != (struct nqlease *)&nqthead) {
|
||||
for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
|
||||
lp = nextlp) {
|
||||
if (lp->lc_expiry >= time.tv_sec)
|
||||
break;
|
||||
nextlp = lp->lc_chain1[0];
|
||||
nextlp = lp->lc_timer.cqe_next;
|
||||
if (lp->lc_flag & LC_EXPIREDWANTED) {
|
||||
lp->lc_flag &= ~LC_EXPIREDWANTED;
|
||||
wakeup((caddr_t)&lp->lc_flag);
|
||||
@ -627,10 +617,8 @@ nqnfs_serverd()
|
||||
lp->lc_flag &= ~LC_WRITTEN;
|
||||
nqsrv_instimeq(lp, nqsrv_writeslack);
|
||||
} else {
|
||||
remque(lp);
|
||||
if (lq = lp->lc_fhnext)
|
||||
lq->lc_fhprev = lp->lc_fhprev;
|
||||
*lp->lc_fhprev = lq;
|
||||
CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
LIST_REMOVE(lp, lc_hash);
|
||||
/*
|
||||
* This soft reference may no longer be valid, but
|
||||
* no harm done. The worst case is if the vnode was
|
||||
@ -671,7 +659,6 @@ nqnfs_serverd()
|
||||
nfsstats.srvnqnfs_leases--;
|
||||
}
|
||||
}
|
||||
lp = nextlp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -756,8 +743,8 @@ nqnfsrv_vacated(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
/*
|
||||
* Find the lease by searching the hash list.
|
||||
*/
|
||||
for (lp = nqfhead[NQFHHASH(fhp->fh_fid.fid_data)]; lp;
|
||||
lp = lp->lc_fhnext)
|
||||
for (lp = NQFHHASH(fhp->fh_fid.fid_data)->lh_first; lp != 0;
|
||||
lp = lp->lc_hash.le_next)
|
||||
if (fhp->fh_fsid.val[0] == lp->lc_fsid.val[0] &&
|
||||
fhp->fh_fsid.val[1] == lp->lc_fsid.val[1] &&
|
||||
!bcmp(fhp->fh_fid.fid_data, lp->lc_fiddata,
|
||||
@ -766,7 +753,7 @@ nqnfsrv_vacated(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
tlp = lp;
|
||||
break;
|
||||
}
|
||||
if (tlp) {
|
||||
if (tlp != 0) {
|
||||
lp = tlp;
|
||||
len = 1;
|
||||
i = 0;
|
||||
@ -926,22 +913,12 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
if (error = nfs_nget(nmp->nm_mountp, fhp, &np))
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
if (np->n_tnext) {
|
||||
if (np->n_timer.cqe_next != 0) {
|
||||
np->n_expiry = 0;
|
||||
np->n_flag |= NQNFSEVICTED;
|
||||
if (np->n_tprev != (struct nfsnode *)nmp) {
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np->n_tprev;
|
||||
else
|
||||
np->n_tnext->n_tprev = np->n_tprev;
|
||||
np->n_tprev->n_tnext = np->n_tnext;
|
||||
np->n_tnext = nmp->nm_tnext;
|
||||
nmp->nm_tnext = np;
|
||||
np->n_tprev = (struct nfsnode *)nmp;
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np;
|
||||
else
|
||||
np->n_tnext->n_tprev = np;
|
||||
if (nmp->nm_timerhead.cqh_first != np) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
CIRCLEQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
|
||||
}
|
||||
}
|
||||
vrele(vp);
|
||||
@ -1018,8 +995,8 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
/*
|
||||
* Loop through the leases, updating as required.
|
||||
*/
|
||||
np = nmp->nm_tnext;
|
||||
while (np != (struct nfsnode *)nmp &&
|
||||
np = nmp->nm_timerhead.cqh_first;
|
||||
while (np != (void *)&nmp->nm_timerhead &&
|
||||
(nmp->nm_flag & NFSMNT_DISMINPROG) == 0) {
|
||||
vp = NFSTOV(np);
|
||||
if (strcmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS)) panic("trash2");
|
||||
@ -1029,15 +1006,8 @@ if (strcmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS)) panic("trash2");
|
||||
nmp->nm_inprog = vp;
|
||||
if (vpid == vp->v_id) {
|
||||
if (strcmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS)) panic("trash3");
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np->n_tprev;
|
||||
else
|
||||
np->n_tnext->n_tprev = np->n_tprev;
|
||||
if (np->n_tprev == (struct nfsnode *)nmp)
|
||||
nmp->nm_tnext = np->n_tnext;
|
||||
else
|
||||
np->n_tprev->n_tnext = np->n_tnext;
|
||||
np->n_tnext = (struct nfsnode *)0;
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
np->n_timer.cqe_next = 0;
|
||||
if ((np->n_flag & (NMODIFIED | NQNFSEVICTED))
|
||||
&& vp->v_type == VREG) {
|
||||
if (np->n_flag & NQNFSEVICTED) {
|
||||
@ -1055,10 +1025,6 @@ if (strcmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS)) panic("trash3");
|
||||
vrele(vp);
|
||||
nmp->nm_inprog = NULLVP;
|
||||
}
|
||||
if (np != nmp->nm_tnext)
|
||||
np = nmp->nm_tnext;
|
||||
else
|
||||
break;
|
||||
} else if ((np->n_expiry - NQ_RENEWAL) < time.tv_sec) {
|
||||
if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE))
|
||||
== NQNFSWRITE && vp->v_dirtyblkhd.lh_first &&
|
||||
@ -1071,12 +1037,11 @@ if (strcmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS)) panic("trash4");
|
||||
vrele(vp);
|
||||
nmp->nm_inprog = NULLVP;
|
||||
}
|
||||
if (np != nmp->nm_tnext)
|
||||
np = nmp->nm_tnext;
|
||||
else
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
if (np == nmp->nm_timerhead.cqh_first)
|
||||
break;
|
||||
np = nmp->nm_timerhead.cqh_first;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1121,15 +1086,8 @@ nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
|
||||
{
|
||||
register struct nfsnode *tp;
|
||||
|
||||
if (np->n_tnext) {
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np->n_tprev;
|
||||
else
|
||||
np->n_tnext->n_tprev = np->n_tprev;
|
||||
if (np->n_tprev == (struct nfsnode *)nmp)
|
||||
nmp->nm_tnext = np->n_tnext;
|
||||
else
|
||||
np->n_tprev->n_tnext = np->n_tnext;
|
||||
if (np->n_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
if (rwflag == NQL_WRITE)
|
||||
np->n_flag |= NQNFSWRITE;
|
||||
} else if (rwflag == NQL_READ)
|
||||
@ -1142,21 +1100,14 @@ nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
|
||||
np->n_flag |= NQNFSNONCACHE;
|
||||
np->n_expiry = expiry;
|
||||
np->n_lrev = frev;
|
||||
tp = nmp->nm_tprev;
|
||||
while (tp != (struct nfsnode *)nmp && tp->n_expiry > np->n_expiry)
|
||||
tp = tp->n_tprev;
|
||||
if (tp == (struct nfsnode *)nmp) {
|
||||
np->n_tnext = nmp->nm_tnext;
|
||||
nmp->nm_tnext = np;
|
||||
tp = nmp->nm_timerhead.cqh_last;
|
||||
while (tp != (void *)&nmp->nm_timerhead && tp->n_expiry > np->n_expiry)
|
||||
tp = tp->n_timer.cqe_prev;
|
||||
if (tp == (void *)&nmp->nm_timerhead) {
|
||||
CIRCLEQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
|
||||
} else {
|
||||
np->n_tnext = tp->n_tnext;
|
||||
tp->n_tnext = np;
|
||||
CIRCLEQ_INSERT_AFTER(&nmp->nm_timerhead, tp, np, n_timer);
|
||||
}
|
||||
np->n_tprev = tp;
|
||||
if (np->n_tnext == (struct nfsnode *)nmp)
|
||||
nmp->nm_tprev = np;
|
||||
else
|
||||
np->n_tnext->n_tprev = np;
|
||||
}
|
||||
#endif /* NFSCLIENT */
|
||||
|
||||
@ -1177,11 +1128,9 @@ lease_updatetime(deltat)
|
||||
if (nqnfsstarttime != 0)
|
||||
nqnfsstarttime += deltat;
|
||||
s = splsoftclock();
|
||||
lp = nqthead.th_chain[0];
|
||||
while (lp != (struct nqlease *)&nqthead) {
|
||||
for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
|
||||
lp = lp->lc_timer.cqe_next)
|
||||
lp->lc_expiry += deltat;
|
||||
lp = lp->lc_chain1[0];
|
||||
}
|
||||
splx(s);
|
||||
|
||||
/*
|
||||
@ -1192,10 +1141,10 @@ lease_updatetime(deltat)
|
||||
if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS)) {
|
||||
nmp = VFSTONFS(mp);
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
np = nmp->nm_tnext;
|
||||
while (np != (struct nfsnode *)nmp) {
|
||||
for (np = nmp->nm_timerhead.cqh_first;
|
||||
np != (void *)&nmp->nm_timerhead;
|
||||
np = np->n_timer.cqe_next) {
|
||||
np->n_expiry += deltat;
|
||||
np = np->n_tnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_subs.c,v 1.17 1994/08/17 14:43:53 mycroft Exp $ */
|
||||
/* $NetBSD: nfs_subs.c,v 1.18 1994/08/18 22:47:53 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -97,6 +97,9 @@ extern int nqsrv_clockskew;
|
||||
extern int nqsrv_writeslack;
|
||||
extern int nqsrv_maxlease;
|
||||
|
||||
LIST_HEAD(nfsnodehashhead, nfsnode);
|
||||
extern struct nfsnodehashhead *nfs_hash __P((nfsv2fh_t *));
|
||||
|
||||
/*
|
||||
* Create the header for an rpc request packet
|
||||
* The hsiz is the size of the rest of the nfs request header.
|
||||
@ -621,9 +624,8 @@ nfs_init()
|
||||
NQLOADNOVRAM(nqnfsstarttime);
|
||||
nqnfs_prog = txdr_unsigned(NQNFS_PROG);
|
||||
nqnfs_vers = txdr_unsigned(NQNFS_VER1);
|
||||
nqthead.th_head[0] = &nqthead;
|
||||
nqthead.th_head[1] = &nqthead;
|
||||
nqfhead = hashinit(NQLCHSZ, M_NQLEASE, &nqfheadhash);
|
||||
CIRCLEQ_INIT(&nqtimerhead);
|
||||
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -658,7 +660,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
register struct vattr *vap;
|
||||
register struct nfsv2_fattr *fp;
|
||||
extern int (**spec_nfsv2nodeop_p)();
|
||||
register struct nfsnode *np, *nq, **nhpp;
|
||||
register struct nfsnode *np;
|
||||
register struct nfsnodehashhead *nhpp;
|
||||
register long t1;
|
||||
caddr_t dpos, cp2;
|
||||
int error = 0, isnq;
|
||||
@ -714,9 +717,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
/*
|
||||
* Discard unneeded vnode, but save its nfsnode.
|
||||
*/
|
||||
if (nq = np->n_forw)
|
||||
nq->n_back = np->n_back;
|
||||
*np->n_back = nq;
|
||||
LIST_REMOVE(np, n_hash);
|
||||
nvp->v_data = vp->v_data;
|
||||
vp->v_data = NULL;
|
||||
vp->v_op = spec_vnodeop_p;
|
||||
@ -726,12 +727,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
* Reinitialize aliased node.
|
||||
*/
|
||||
np->n_vnode = nvp;
|
||||
nhpp = (struct nfsnode **)nfs_hash(&np->n_fh);
|
||||
if (nq = *nhpp)
|
||||
nq->n_back = &np->n_forw;
|
||||
np->n_forw = nq;
|
||||
np->n_back = nhpp;
|
||||
*nhpp = np;
|
||||
nhpp = nfs_hash(&np->n_fh);
|
||||
LIST_INSERT_HEAD(nhpp, np, n_hash);
|
||||
*vpp = vp = nvp;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.30 1994/08/14 03:35:27 gwr Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.31 1994/08/18 22:48:00 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -496,8 +496,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
|
||||
nmp->nm_readahead = NFS_DEFRAHEAD;
|
||||
nmp->nm_leaseterm = NQ_DEFLEASE;
|
||||
nmp->nm_deadthresh = NQ_DEADTHRESH;
|
||||
nmp->nm_tnext = (struct nfsnode *)nmp;
|
||||
nmp->nm_tprev = (struct nfsnode *)nmp;
|
||||
CIRCLEQ_INIT(&nmp->nm_timerhead);
|
||||
nmp->nm_inprog = NULLVP;
|
||||
bcopy((caddr_t)argp->fh, (caddr_t)&nmp->nm_fh, sizeof(nfsv2fh_t));
|
||||
#ifdef COMPAT_09
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsmount.h,v 1.5 1994/06/29 06:42:34 cgd Exp $ */
|
||||
/* $NetBSD: nfsmount.h,v 1.6 1994/08/18 22:48:03 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -65,8 +65,7 @@ struct nfsmount {
|
||||
int nm_wsize; /* Max size of write rpc */
|
||||
int nm_readahead; /* Num. of blocks to readahead */
|
||||
int nm_leaseterm; /* Term (sec) for NQNFS lease */
|
||||
struct nfsnode *nm_tnext; /* Head of lease timer queue */
|
||||
struct nfsnode *nm_tprev;
|
||||
CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
|
||||
struct vnode *nm_inprog; /* Vnode in prog by nqnfs_clientd() */
|
||||
uid_t nm_authuid; /* Uid for authenticator */
|
||||
int nm_authtype; /* Authenticator type */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsnode.h,v 1.11 1994/06/29 06:42:35 cgd Exp $ */
|
||||
/* $NetBSD: nfsnode.h,v 1.12 1994/08/18 22:48:05 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -58,8 +58,8 @@ struct sillyrename {
|
||||
*/
|
||||
|
||||
struct nfsnode {
|
||||
struct nfsnode *n_forw; /* hash, forward */
|
||||
struct nfsnode **n_back; /* hash, backward */
|
||||
LIST_ENTRY(nfsnode) n_hash; /* Hash chain */
|
||||
CIRCLEQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
|
||||
nfsv2fh_t n_fh; /* NFS File Handle */
|
||||
long n_flag; /* Flag for locking.. */
|
||||
struct vnode *n_vnode; /* vnode associated with this node */
|
||||
@ -74,8 +74,6 @@ struct nfsnode {
|
||||
u_quad_t n_brev; /* Modify rev when cached */
|
||||
u_quad_t n_lrev; /* Modify rev for lease */
|
||||
time_t n_expiry; /* Lease expiry time */
|
||||
struct nfsnode *n_tnext; /* Nqnfs timer chain */
|
||||
struct nfsnode *n_tprev;
|
||||
struct lockf *n_lockf; /* Advisory lock records */
|
||||
struct sillyrename n_silly; /* Silly rename struct */
|
||||
struct timeval n_atim; /* Special file times */
|
||||
@ -105,7 +103,7 @@ struct nfsnode {
|
||||
/*
|
||||
* Queue head for nfsiod's
|
||||
*/
|
||||
TAILQ_HEAD(nfsbufs, buf) nfs_bufq;
|
||||
TAILQ_HEAD(, buf) nfs_bufq;
|
||||
|
||||
#ifdef KERNEL
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsrvcache.h,v 1.6 1994/08/17 12:34:14 mycroft Exp $ */
|
||||
/* $NetBSD: nfsrvcache.h,v 1.7 1994/08/18 22:48:08 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -45,8 +45,8 @@
|
||||
#define NFSRVCACHESIZ 256
|
||||
|
||||
struct nfsrvcache {
|
||||
LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */
|
||||
TAILQ_ENTRY(nfsrvcache) rc_lru; /* LRU chain */
|
||||
LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */
|
||||
u_long rc_xid; /* rpc id number */
|
||||
union {
|
||||
struct mbuf *ru_repmb; /* Reply mbuf list OR */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nqnfs.h,v 1.2 1994/06/29 06:42:41 cgd Exp $ */
|
||||
/* $NetBSD: nqnfs.h,v 1.3 1994/08/18 22:48:10 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -107,9 +107,8 @@ struct nqhost {
|
||||
#define lph_slp lph_un.un_conn.conn_slp
|
||||
|
||||
struct nqlease {
|
||||
struct nqlease *lc_chain1[2]; /* Timer queue list (must be first) */
|
||||
struct nqlease *lc_fhnext; /* Fhandle hash list */
|
||||
struct nqlease **lc_fhprev;
|
||||
LIST_ENTRY(nqlease) lc_hash; /* Fhandle hash list */
|
||||
CIRCLEQ_ENTRY(nqlease) lc_timer; /* Timer queue list */
|
||||
time_t lc_expiry; /* Expiry time (sec) */
|
||||
struct nqhost lc_host; /* Host that got lease */
|
||||
struct nqm *lc_morehosts; /* Other hosts that share read lease */
|
||||
@ -185,12 +184,15 @@ struct nqm {
|
||||
/*
|
||||
* List head for timer queue.
|
||||
*/
|
||||
extern union nqsrvthead {
|
||||
union nqsrvthead *th_head[2];
|
||||
struct nqlease *th_chain[2];
|
||||
} nqthead;
|
||||
extern struct nqlease **nqfhead;
|
||||
extern u_long nqfheadhash;
|
||||
CIRCLEQ_HEAD(, nqlease) nqtimerhead;
|
||||
|
||||
/*
|
||||
* List head for the file handle hash table.
|
||||
*/
|
||||
#define NQFHHASH(f) \
|
||||
(&nqfhhashtbl[(*((u_long *)(f))) & nqfhhash])
|
||||
LIST_HEAD(nqfhhashhead, nqlease) *nqfhhashtbl;
|
||||
u_long nqfhhash;
|
||||
|
||||
/*
|
||||
* Nqnfs return status numbers.
|
||||
|
Loading…
Reference in New Issue
Block a user