Move the NFS/RPC code away from lbolt.
The kernel has a special wchan called `lbolt', which is triggered each second. It doesn't seem to be used a lot and it seems pretty redundant, because we can specify a timeout value to the *sleep() routines. In an attempt to eventually remove lbolt, make the NFS/RPC code use a timeout of `hz' when trying to reconnect. Only the TTY code (not MPSAFE TTY) and the VFS syncer seem to use lbolt now. Reviewed by: attilio, jhb Approved by: philip (mentor), alfred, dfr
This commit is contained in:
parent
dfa80a42e2
commit
1e4302f67a
@ -298,7 +298,7 @@ nfs4_request_mnt(struct nfsmount *nmp, struct mbuf *mrest, int procnum,
|
||||
error = 0;
|
||||
waituntil = time_second + trylater_delay;
|
||||
while (time_second < waituntil)
|
||||
(void) tsleep(&lbolt, PSOCK, "nqnfstry", 0);
|
||||
(void) tsleep(&fake_wchan, PSOCK, "nqnfstry", hz);
|
||||
trylater_delay *= nfs_backoff[trylater_cnt];
|
||||
if (trylater_cnt < NFS_NBACKOFF - 1)
|
||||
trylater_cnt++;
|
||||
|
@ -127,6 +127,8 @@ static vfs_root_t nfs4_root;
|
||||
static vfs_statfs_t nfs4_statfs;
|
||||
static vfs_sync_t nfs4_sync;
|
||||
|
||||
static int fake_wchan;
|
||||
|
||||
/*
|
||||
* nfs vfs operations.
|
||||
*/
|
||||
@ -374,7 +376,7 @@ nfs4_decode_args(struct nfsmount *nmp, struct nfs_args *argp)
|
||||
if (nmp->nm_sotype == SOCK_DGRAM) {
|
||||
while (nfs4_connect(nmp)) {
|
||||
printf("nfs4_decode_args: retrying connect\n");
|
||||
(void)tsleep(&lbolt, PSOCK, "nfscon", 0);
|
||||
(void)tsleep(&fake_wchan, PSOCK, "nfscon", hz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,8 +81,9 @@ static int nfs_realign_test;
|
||||
static int nfs_realign_count;
|
||||
static int nfs_bufpackets = 4;
|
||||
static int nfs_reconnects;
|
||||
static int nfs3_jukebox_delay = 10;
|
||||
static int nfs_skip_wcc_data_onerr = 1;
|
||||
static int nfs3_jukebox_delay = 10;
|
||||
static int nfs_skip_wcc_data_onerr = 1;
|
||||
static int fake_wchan;
|
||||
|
||||
SYSCTL_DECL(_vfs_nfs);
|
||||
|
||||
@ -546,7 +547,7 @@ nfs_reconnect(struct nfsreq *rep)
|
||||
mtx_lock(&nmp->nm_mtx);
|
||||
goto unlock_exit;
|
||||
}
|
||||
(void) tsleep(&lbolt, PSOCK, "nfscon", 0);
|
||||
(void) tsleep(&fake_wchan, PSOCK, "nfscon", hz);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1346,7 +1347,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
|
||||
error = 0;
|
||||
waituntil = time_second + nfs3_jukebox_delay;
|
||||
while (time_second < waituntil) {
|
||||
(void) tsleep(&lbolt, PSOCK, "nqnfstry", 0);
|
||||
(void) tsleep(&fake_wchan, PSOCK, "nqnfstry", hz);
|
||||
}
|
||||
rep->r_xid = *xidp = txdr_unsigned(nfs_xid_gen());
|
||||
goto tryagain;
|
||||
@ -1610,7 +1611,7 @@ nfs_nmcancelreqs(nmp)
|
||||
mtx_unlock(&nfs_reqq_mtx);
|
||||
if (req == NULL)
|
||||
return (0);
|
||||
tsleep(&lbolt, PSOCK, "nfscancel", 0);
|
||||
tsleep(&fake_wchan, PSOCK, "nfscancel", hz);
|
||||
}
|
||||
return (EBUSY);
|
||||
}
|
||||
|
@ -117,6 +117,8 @@ static vfs_statfs_t nfs_statfs;
|
||||
static vfs_sync_t nfs_sync;
|
||||
static vfs_sysctl_t nfs_sysctl;
|
||||
|
||||
static int fake_wchan;
|
||||
|
||||
/*
|
||||
* nfs vfs operations.
|
||||
*/
|
||||
@ -700,7 +702,7 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp)
|
||||
if (nmp->nm_sotype == SOCK_DGRAM)
|
||||
while (nfs_connect(nmp, NULL)) {
|
||||
printf("nfs_args: retrying connect\n");
|
||||
(void) tsleep((caddr_t)&lbolt, PSOCK, "nfscon", 0);
|
||||
(void) tsleep(&fake_wchan, PSOCK, "nfscon", hz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,7 @@ static u_int32_t rpcclnt_xid = 0;
|
||||
static u_int32_t rpcclnt_xid_touched = 0;
|
||||
struct rpcstats rpcstats;
|
||||
int rpcclnt_ticks;
|
||||
static int fake_wchan;
|
||||
|
||||
SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RD, 0, "RPC Subsystem");
|
||||
|
||||
@ -597,7 +598,7 @@ rpcclnt_reconnect(rep, td)
|
||||
while ((error = rpcclnt_connect(rpc, td)) != 0) {
|
||||
if (error == EINTR || error == ERESTART)
|
||||
RPC_RETURN(EINTR);
|
||||
tsleep(&lbolt, PSOCK, "rpccon", 0);
|
||||
tsleep(&fake_wchan, PSOCK, "rpccon", hz);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2003,7 +2004,7 @@ rpcclnt_cancelreqs(rpc)
|
||||
splx(s);
|
||||
if (task == NULL)
|
||||
return (0);
|
||||
tsleep(&lbolt, PSOCK, "nfscancel", 0);
|
||||
tsleep(&fake_wchan, PSOCK, "nfscancel", hz);
|
||||
}
|
||||
return (EBUSY);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user