mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-01 08:27:59 +00:00
In preparation for deprecating CIRCLEQ macros in favor of TAILQ
macros which provide the same functionality and are a bit more efficient, convert use of CIRCLEQ's in NFS to TAILQ's.
This commit is contained in:
parent
b03c558b5a
commit
d6514f21d7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68711
@ -1141,7 +1141,7 @@ nfs_init(vfsp)
|
||||
nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
|
||||
+ nqsrv_clockskew + nqsrv_writeslack;
|
||||
NQLOADNOVRAM(nqnfsstarttime);
|
||||
CIRCLEQ_INIT(&nqtimerhead);
|
||||
TAILQ_INIT(&nqtimerhead);
|
||||
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
|
||||
}
|
||||
|
||||
|
@ -279,8 +279,8 @@ nfs_reclaim(ap)
|
||||
/*
|
||||
* For nqnfs, take it off the timer queue as required.
|
||||
*/
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && np->n_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && TAILQ_NEXT(np, n_timer) != 0) {
|
||||
TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -414,25 +414,25 @@ nqsrv_instimeq(lp, duration)
|
||||
newexpiry = time_second + duration + nqsrv_clockskew;
|
||||
if (lp->lc_expiry == newexpiry)
|
||||
return;
|
||||
if (lp->lc_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
if (TAILQ_NEXT(lp, lc_timer) != 0) {
|
||||
TAILQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
}
|
||||
lp->lc_expiry = newexpiry;
|
||||
|
||||
/*
|
||||
* Find where in the queue it should be.
|
||||
*/
|
||||
tlp = nqtimerhead.cqh_last;
|
||||
while (tlp != (void *)&nqtimerhead && tlp->lc_expiry > newexpiry)
|
||||
tlp = tlp->lc_timer.cqe_prev;
|
||||
TAILQ_FOREACH_REVERSE(tlp, &nqtimerhead, nqtimerhead, lc_timer)
|
||||
if (tlp->lc_expiry <= newexpiry)
|
||||
break;
|
||||
#ifdef HASNVRAM
|
||||
if (tlp == nqtimerhead.cqh_last)
|
||||
if (tlp == TAILQ_LAST(&nqtimerhead))
|
||||
NQSTORENOVRAM(newexpiry);
|
||||
#endif /* HASNVRAM */
|
||||
if (tlp == (void *)&nqtimerhead) {
|
||||
CIRCLEQ_INSERT_HEAD(&nqtimerhead, lp, lc_timer);
|
||||
if (tlp == NULL) {
|
||||
TAILQ_INSERT_HEAD(&nqtimerhead, lp, lc_timer);
|
||||
} else {
|
||||
CIRCLEQ_INSERT_AFTER(&nqtimerhead, tlp, lp, lc_timer);
|
||||
TAILQ_INSERT_AFTER(&nqtimerhead, tlp, lp, lc_timer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,11 +647,10 @@ nqnfs_serverd()
|
||||
struct nqm *lphnext, *olphnext;
|
||||
int i, len, ok;
|
||||
|
||||
for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
|
||||
lp = nextlp) {
|
||||
for (lp = TAILQ_FIRST(&nqtimerhead); lp; lp = nextlp) {
|
||||
if (lp->lc_expiry >= time_second)
|
||||
break;
|
||||
nextlp = lp->lc_timer.cqe_next;
|
||||
nextlp = TAILQ_NEXT(lp, lc_timer);
|
||||
if (lp->lc_flag & LC_EXPIREDWANTED) {
|
||||
lp->lc_flag &= ~LC_EXPIREDWANTED;
|
||||
wakeup((caddr_t)&lp->lc_flag);
|
||||
@ -672,7 +671,7 @@ nqnfs_serverd()
|
||||
lp->lc_flag &= ~LC_WRITTEN;
|
||||
nqsrv_instimeq(lp, nqsrv_writeslack);
|
||||
} else {
|
||||
CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
TAILQ_REMOVE(&nqtimerhead, lp, lc_timer);
|
||||
LIST_REMOVE(lp, lc_hash);
|
||||
/*
|
||||
* This soft reference may no longer be valid, but
|
||||
@ -995,12 +994,12 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
if (error)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
if (np->n_timer.cqe_next != 0) {
|
||||
if (TAILQ_NEXT(np, n_timer) != 0) {
|
||||
np->n_expiry = 0;
|
||||
np->n_flag |= NQNFSEVICTED;
|
||||
if (nmp->nm_timerhead.cqh_first != np) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
CIRCLEQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
|
||||
if (TAILQ_FIRST(&nmp->nm_timerhead) != np) {
|
||||
TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
TAILQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
|
||||
}
|
||||
}
|
||||
vput(vp);
|
||||
@ -1083,17 +1082,17 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
/*
|
||||
* Loop through the leases, updating as required.
|
||||
*/
|
||||
np = nmp->nm_timerhead.cqh_first;
|
||||
while (np != (void *)&nmp->nm_timerhead &&
|
||||
(nmp->nm_state & NFSSTA_DISMINPROG) == 0) {
|
||||
while ((np = TAILQ_FIRST(&nmp->nm_timerhead)) != NULL) {
|
||||
if (nmp->nm_state & NFSSTA_DISMINPROG)
|
||||
break;
|
||||
vp = NFSTOV(np);
|
||||
vpid = vp->v_id;
|
||||
if (np->n_expiry < time_second) {
|
||||
if (vget(vp, LK_EXCLUSIVE, p) == 0) {
|
||||
nmp->nm_inprog = vp;
|
||||
if (vpid == vp->v_id) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
np->n_timer.cqe_next = 0;
|
||||
TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
TAILQ_NEXT(np, n_timer) = 0;
|
||||
if (np->n_flag & (NMODIFIED | NQNFSEVICTED)) {
|
||||
if (np->n_flag & NQNFSEVICTED) {
|
||||
if (vp->v_type == VDIR)
|
||||
@ -1127,9 +1126,6 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
}
|
||||
} else
|
||||
break;
|
||||
if (np == nmp->nm_timerhead.cqh_first)
|
||||
break;
|
||||
np = nmp->nm_timerhead.cqh_first;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1191,8 +1187,7 @@ nqnfs_lease_updatetime(deltat)
|
||||
if (nqnfsstarttime != 0)
|
||||
nqnfsstarttime += deltat;
|
||||
s = splsoftclock();
|
||||
for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
|
||||
lp = lp->lc_timer.cqe_next)
|
||||
TAILQ_FOREACH(lp, &nqtimerhead, lc_timer)
|
||||
lp->lc_expiry += deltat;
|
||||
splx(s);
|
||||
|
||||
@ -1209,9 +1204,7 @@ nqnfs_lease_updatetime(deltat)
|
||||
if (mp->mnt_stat.f_type == nfs_mount_type) {
|
||||
nmp = VFSTONFS(mp);
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
for (np = nmp->nm_timerhead.cqh_first;
|
||||
np != (void *)&nmp->nm_timerhead;
|
||||
np = np->n_timer.cqe_next) {
|
||||
TAILQ_FOREACH(np, &nmp->nm_timerhead, n_timer) {
|
||||
np->n_expiry += deltat;
|
||||
}
|
||||
}
|
||||
@ -1267,8 +1260,8 @@ nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
|
||||
{
|
||||
register struct nfsnode *tp;
|
||||
|
||||
if (np->n_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
if (TAILQ_NEXT(np, n_timer) != 0) {
|
||||
TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
if (rwflag == ND_WRITE)
|
||||
np->n_flag |= NQNFSWRITE;
|
||||
} else if (rwflag == ND_READ)
|
||||
@ -1281,12 +1274,12 @@ nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
|
||||
np->n_flag |= NQNFSNONCACHE;
|
||||
np->n_expiry = expiry;
|
||||
np->n_lrev = frev;
|
||||
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);
|
||||
TAILQ_FOREACH_REVERSE(tp, &nmp->nm_timerhead, timhd, n_timer)
|
||||
if (tp->n_expiry <= np->n_expiry)
|
||||
break;
|
||||
if (tp == NULL) {
|
||||
TAILQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
|
||||
} else {
|
||||
CIRCLEQ_INSERT_AFTER(&nmp->nm_timerhead, tp, np, n_timer);
|
||||
TAILQ_INSERT_AFTER(&nmp->nm_timerhead, tp, np, n_timer);
|
||||
}
|
||||
}
|
||||
|
@ -1141,7 +1141,7 @@ nfs_init(vfsp)
|
||||
nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
|
||||
+ nqsrv_clockskew + nqsrv_writeslack;
|
||||
NQLOADNOVRAM(nqnfsstarttime);
|
||||
CIRCLEQ_INIT(&nqtimerhead);
|
||||
TAILQ_INIT(&nqtimerhead);
|
||||
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
|
||||
}
|
||||
|
||||
|
@ -890,7 +890,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
|
||||
nmp->nm_readahead = NFS_DEFRAHEAD;
|
||||
nmp->nm_leaseterm = NQ_DEFLEASE;
|
||||
nmp->nm_deadthresh = NQ_DEADTHRESH;
|
||||
CIRCLEQ_INIT(&nmp->nm_timerhead);
|
||||
TAILQ_INIT(&nmp->nm_timerhead);
|
||||
nmp->nm_inprog = NULLVP;
|
||||
nmp->nm_fhsize = argp->fhsize;
|
||||
bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize);
|
||||
|
@ -75,7 +75,7 @@ struct nfsmount {
|
||||
int nm_acdirmax; /* Directory attr cache max lifetime */
|
||||
int nm_acregmin; /* Reg file attr cache min lifetime */
|
||||
int nm_acregmax; /* Reg file attr cache max lifetime */
|
||||
CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
|
||||
TAILQ_HEAD(timhd, 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 */
|
||||
|
@ -87,7 +87,7 @@ struct nfsdmap {
|
||||
*/
|
||||
struct nfsnode {
|
||||
LIST_ENTRY(nfsnode) n_hash; /* Hash chain */
|
||||
CIRCLEQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
|
||||
TAILQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
|
||||
u_quad_t n_size; /* Current size of file */
|
||||
u_quad_t n_brev; /* Modify rev when cached */
|
||||
u_quad_t n_lrev; /* Modify rev for lease */
|
||||
|
@ -105,7 +105,7 @@ struct nqhost {
|
||||
|
||||
struct nqlease {
|
||||
LIST_ENTRY(nqlease) lc_hash; /* Fhandle hash list */
|
||||
CIRCLEQ_ENTRY(nqlease) lc_timer; /* Timer queue list */
|
||||
TAILQ_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 */
|
||||
@ -173,7 +173,7 @@ struct nqm {
|
||||
/*
|
||||
* List head for timer queue.
|
||||
*/
|
||||
extern CIRCLEQ_HEAD(nqtimerhead, nqlease) nqtimerhead;
|
||||
extern TAILQ_HEAD(nqtimerhead, nqlease) nqtimerhead;
|
||||
|
||||
/*
|
||||
* List head for the file handle hash table.
|
||||
|
@ -279,8 +279,8 @@ nfs_reclaim(ap)
|
||||
/*
|
||||
* For nqnfs, take it off the timer queue as required.
|
||||
*/
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && np->n_timer.cqe_next != 0) {
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) && TAILQ_NEXT(np, n_timer) != 0) {
|
||||
TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1141,7 +1141,7 @@ nfs_init(vfsp)
|
||||
nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
|
||||
+ nqsrv_clockskew + nqsrv_writeslack;
|
||||
NQLOADNOVRAM(nqnfsstarttime);
|
||||
CIRCLEQ_INIT(&nqtimerhead);
|
||||
TAILQ_INIT(&nqtimerhead);
|
||||
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
|
||||
}
|
||||
|
||||
|
@ -890,7 +890,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
|
||||
nmp->nm_readahead = NFS_DEFRAHEAD;
|
||||
nmp->nm_leaseterm = NQ_DEFLEASE;
|
||||
nmp->nm_deadthresh = NQ_DEADTHRESH;
|
||||
CIRCLEQ_INIT(&nmp->nm_timerhead);
|
||||
TAILQ_INIT(&nmp->nm_timerhead);
|
||||
nmp->nm_inprog = NULLVP;
|
||||
nmp->nm_fhsize = argp->fhsize;
|
||||
bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize);
|
||||
|
@ -75,7 +75,7 @@ struct nfsmount {
|
||||
int nm_acdirmax; /* Directory attr cache max lifetime */
|
||||
int nm_acregmin; /* Reg file attr cache min lifetime */
|
||||
int nm_acregmax; /* Reg file attr cache max lifetime */
|
||||
CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
|
||||
TAILQ_HEAD(timhd, 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 */
|
||||
|
@ -87,7 +87,7 @@ struct nfsdmap {
|
||||
*/
|
||||
struct nfsnode {
|
||||
LIST_ENTRY(nfsnode) n_hash; /* Hash chain */
|
||||
CIRCLEQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
|
||||
TAILQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
|
||||
u_quad_t n_size; /* Current size of file */
|
||||
u_quad_t n_brev; /* Modify rev when cached */
|
||||
u_quad_t n_lrev; /* Modify rev for lease */
|
||||
|
@ -1141,7 +1141,7 @@ nfs_init(vfsp)
|
||||
nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
|
||||
+ nqsrv_clockskew + nqsrv_writeslack;
|
||||
NQLOADNOVRAM(nqnfsstarttime);
|
||||
CIRCLEQ_INIT(&nqtimerhead);
|
||||
TAILQ_INIT(&nqtimerhead);
|
||||
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user