summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_socket.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-03-30 09:56:58 +0000
committerphk <phk@FreeBSD.org>1998-03-30 09:56:58 +0000
commit9b703b14551addf9806978973e2ddc427d4908b4 (patch)
tree91f2de8432f719153d0de9465a9ebeee33c29077 /sys/nfsclient/nfs_socket.c
parentadd2782c4ec0d7c4447da2b33d1413a2754f8a3e (diff)
downloadFreeBSD-src-9b703b14551addf9806978973e2ddc427d4908b4.zip
FreeBSD-src-9b703b14551addf9806978973e2ddc427d4908b4.tar.gz
Eradicate the variable "time" from the kernel, using various measures.
"time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
Diffstat (limited to 'sys/nfsclient/nfs_socket.c')
-rw-r--r--sys/nfsclient/nfs_socket.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c
index ed23c69..5c084b7 100644
--- a/sys/nfsclient/nfs_socket.c
+++ b/sys/nfsclient/nfs_socket.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_socket.c,v 1.29 1997/10/12 20:25:44 phk Exp $
+ * $Id: nfs_socket.c,v 1.30 1997/10/28 15:59:07 bde Exp $
*/
/*
@@ -769,7 +769,7 @@ nfsmout:
rt->srtt = nmp->nm_srtt[proct[rep->r_procnum] - 1];
rt->sdrtt = nmp->nm_sdrtt[proct[rep->r_procnum] - 1];
rt->fsid = nmp->nm_mountp->mnt_stat.f_fsid;
- gettime(&rt->tstamp);
+ getmicrotime(&rt->tstamp);
if (rep->r_flags & R_TIMING)
rt->rtt = rep->r_rtt;
else
@@ -952,7 +952,7 @@ tryagain:
TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
- reqtime = time.tv_sec;
+ reqtime = time_second;
/*
* If backing off another request or avoiding congestion, don't
@@ -1062,8 +1062,8 @@ tryagain:
error == NFSERR_TRYLATER) {
m_freem(mrep);
error = 0;
- waituntil = time.tv_sec + trylater_delay;
- while (time.tv_sec < waituntil)
+ waituntil = time_second + trylater_delay;
+ while (time_second < waituntil)
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nqnfstry", 0);
trylater_delay *= nfs_backoff[trylater_cnt];
@@ -1101,7 +1101,7 @@ tryagain:
nfsm_dissect(tl, u_long *, 4*NFSX_UNSIGNED);
cachable = fxdr_unsigned(int, *tl++);
reqtime += fxdr_unsigned(int, *tl++);
- if (reqtime > time.tv_sec) {
+ if (reqtime > time_second) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, nqlflag,
cachable, reqtime, frev);
@@ -1395,8 +1395,8 @@ nfs_timer(arg)
/*
* Call the nqnfs server timer once a second to handle leases.
*/
- if (lasttime != time.tv_sec) {
- lasttime = time.tv_sec;
+ if (lasttime != time_second) {
+ lasttime = time_second;
nqnfs_serverd();
}
@@ -1404,7 +1404,7 @@ nfs_timer(arg)
* Scan the write gathering queues for writes that need to be
* completed now.
*/
- cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
+ cur_usec = nfs_curusec();
for (slp = nfssvc_sockhead.tqh_first; slp != 0;
slp = slp->ns_chain.tqe_next) {
if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time<=cur_usec)
@@ -2125,7 +2125,7 @@ nfs_getreq(nd, nfsd, has_header)
tvout.tv_sec = fxdr_unsigned(long, tvout.tv_sec);
tvout.tv_usec = fxdr_unsigned(long, tvout.tv_usec);
- if (nuidp->nu_expire < time.tv_sec ||
+ if (nuidp->nu_expire < time_second ||
nuidp->nu_timestamp.tv_sec > tvout.tv_sec ||
(nuidp->nu_timestamp.tv_sec == tvout.tv_sec &&
nuidp->nu_timestamp.tv_usec > tvout.tv_usec)) {
OpenPOWER on IntegriCloud