Change the reply list to a TAILQ.

This commit is contained in:
mycroft 1994-08-17 11:41:36 +00:00
parent 9db57a0aa0
commit dbd174a5da
4 changed files with 19 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs.h,v 1.4 1994/06/29 06:42:03 cgd Exp $ */
/* $NetBSD: nfs.h,v 1.5 1994/08/17 11:41:36 mycroft Exp $ */
/*
* Copyright (c) 1989, 1993
@ -173,8 +173,7 @@ struct nfsstats {
* Nfs outstanding request list element
*/
struct nfsreq {
struct nfsreq *r_next;
struct nfsreq *r_prev;
TAILQ_ENTRY(nfsreq) r_chain;
struct mbuf *r_mreq;
struct mbuf *r_mrep;
struct mbuf *r_md;
@ -191,6 +190,11 @@ struct nfsreq {
struct proc *r_procp; /* Proc that did I/O system call */
};
/*
* Queue head for nfsreq's
*/
TAILQ_HEAD(nfsreqs, nfsreq) nfs_reqq;
/* Flag values for r_flags */
#define R_TIMING 0x01 /* timing request (in mntp) */
#define R_SENT 0x02 /* request has been sent */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_nqlease.c,v 1.2 1994/06/29 06:42:11 cgd Exp $ */
/* $NetBSD: nfs_nqlease.c,v 1.3 1994/08/17 11:41:39 mycroft Exp $ */
/*
* Copyright (c) 1992, 1993
@ -131,7 +131,6 @@ extern nfstype nfs_type[9];
extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
extern struct nfsd nfsd_head;
extern int nfsd_waiting;
extern struct nfsreq nfsreqh;
#define TRUE 1
#define FALSE 0
@ -1008,7 +1007,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
* processes in nfs_reply) and there is data in the receive
* queue, poke for callbacks.
*/
if (nfsreqh.r_next == &nfsreqh && nmp->nm_so &&
if (nfs_reqq.tqh_first == 0 && nmp->nm_so &&
nmp->nm_so->so_rcv.sb_cc > 0) {
myrep.r_flags = R_GETONEREP;
myrep.r_nmp = nmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_socket.c,v 1.15 1994/06/29 06:42:16 cgd Exp $ */
/* $NetBSD: nfs_socket.c,v 1.16 1994/08/17 11:41:42 mycroft Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@ -161,8 +161,6 @@ int nfsrtton = 0;
struct nfsrtt nfsrtt;
struct nfsd nfsd_head;
struct nfsreq nfsreqh;
/*
* Initialize sockets and congestion for a new NFS connection.
* We do not free the sockaddr if error.
@ -323,11 +321,9 @@ nfs_reconnect(rep)
* Loop through outstanding request list and fix up all requests
* on old socket.
*/
rp = nfsreqh.r_next;
while (rp != &nfsreqh) {
for (rp = nfs_reqq.tqh_first; rp != 0; rp = rp->r_chain.tqe_next) {
if (rp->r_nmp == nmp)
rp->r_flags |= R_MUSTRESEND;
rp = rp->r_next;
}
return (0);
}
@ -710,8 +706,8 @@ nfsmout:
* Loop through the request list to match up the reply
* Iff no match, just drop the datagram
*/
rep = nfsreqh.r_next;
while (rep != &nfsreqh) {
for (rep = nfs_reqq.tqh_first; rep != 0;
rep = rep->r_chain.tqe_next) {
if (rep->r_mrep == NULL && rxid == rep->r_xid) {
/* Found it.. */
rep->r_mrep = mrep;
@ -773,13 +769,12 @@ nfsmout:
nmp->nm_timeouts = 0;
break;
}
rep = rep->r_next;
}
/*
* If not matched to a request, drop it.
* If it's mine, get out.
*/
if (rep == &nfsreqh) {
if (rep == 0) {
nfsstats.rpcunexpected++;
m_freem(mrep);
} else if (rep == myrep) {
@ -904,11 +899,7 @@ tryagain:
* to put it LAST so timer finds oldest requests first.
*/
s = splsoftclock();
reph = &nfsreqh;
reph->r_prev->r_next = rep;
rep->r_prev = reph->r_prev;
reph->r_prev = rep;
rep->r_next = reph;
TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
reqtime = time.tv_sec;
@ -949,8 +940,7 @@ tryagain:
* RPC done, unlink the request.
*/
s = splsoftclock();
rep->r_prev->r_next = rep->r_next;
rep->r_next->r_prev = rep->r_prev;
TAILQ_REMOVE(&nfs_reqq, rep, r_chain);
splx(s);
/*
@ -1195,7 +1185,7 @@ nfs_timer(arg)
int s, error;
s = splnet();
for (rep = nfsreqh.r_next; rep != &nfsreqh; rep = rep->r_next) {
for (rep = nfs_reqq.tqh_first; rep != 0; rep = rep->r_chain.tqe_next) {
nmp = rep->r_nmp;
if (rep->r_mrep || (rep->r_flags & R_SOFTTERM))
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.15 1994/07/22 23:16:36 mycroft Exp $ */
/* $NetBSD: nfs_subs.c,v 1.16 1994/08/17 11:41:44 mycroft Exp $ */
/*
* Copyright (c) 1989, 1993
@ -89,7 +89,6 @@ u_long nfs_vers, nfs_prog, nfs_true, nfs_false;
static u_long nfs_xid = 0;
enum vtype ntov_type[7] = { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON };
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern struct nfsreq nfsreqh;
extern int nqnfs_piggy[NFS_NPROCS];
extern struct nfsrtt nfsrtt;
extern time_t nqnfsstarttime;
@ -630,7 +629,7 @@ nfs_init()
/*
* Initialize reply list and start timer
*/
nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
TAILQ_INIT(&nfs_reqq);
nfs_timer();
}