diff options
author | rees <rees@FreeBSD.org> | 2004-03-25 21:48:09 +0000 |
---|---|---|
committer | rees <rees@FreeBSD.org> | 2004-03-25 21:48:09 +0000 |
commit | 4bf96c35a5e7311c05b04cba19ee0fabf9dd7e6d (patch) | |
tree | 0f26711985dd062f959b4e838a8d83a0dbd7e570 /sys | |
parent | 75ae6199e5dd7d621ed42390e425658541a06f48 (diff) | |
download | FreeBSD-src-4bf96c35a5e7311c05b04cba19ee0fabf9dd7e6d.zip FreeBSD-src-4bf96c35a5e7311c05b04cba19ee0fabf9dd7e6d.tar.gz |
only do nfs rpc callouts if there is work to do.
Submitted by: kan
Approved by: alfred
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfsclient/nfs.h | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfs_socket.c | 7 | ||||
-rw-r--r-- | sys/nfsclient/nfs_subs.c | 5 | ||||
-rw-r--r-- | sys/rpc/rpcclnt.c | 11 |
4 files changed, 14 insertions, 11 deletions
diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h index 2ac6bbc..5f38f33 100644 --- a/sys/nfsclient/nfs.h +++ b/sys/nfsclient/nfs.h @@ -136,7 +136,7 @@ MALLOC_DECLARE(M_NFSHASH); extern struct uma_zone *nfsmount_zone; -extern struct callout_handle nfs_timer_handle; +extern struct callout nfs_callout; extern struct nfsstats nfsstats; extern int nfs_numasync; diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index c70ab03..697478c 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -140,7 +140,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0, ""); #define NFS_MAXCWND (NFS_CWNDSCALE * 32) #define NFS_NBACKOFF 8 static int nfs_backoff[NFS_NBACKOFF] = { 2, 4, 8, 16, 32, 64, 128, 256, }; -struct callout_handle nfs_timer_handle; +struct callout nfs_callout; static int nfs_msg(struct thread *, char *, char *); static int nfs_rcvlock(struct nfsreq *); @@ -938,6 +938,8 @@ tryagain: * to put it LAST so timer finds oldest requests first. */ s = splsoftclock(); + if (TAILQ_EMPTY(&nfs_reqq)) + callout_reset(&nfs_callout, nfs_ticks, nfs_timer, NULL); TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain); /* @@ -977,6 +979,8 @@ tryagain: */ s = splsoftclock(); TAILQ_REMOVE(&nfs_reqq, rep, r_chain); + if (TAILQ_EMPTY(&nfs_reqq)) + callout_stop(&nfs_callout); splx(s); /* @@ -1184,7 +1188,6 @@ nfs_timer(void *arg) } } splx(s); - nfs_timer_handle = timeout(nfs_timer, NULL, nfs_ticks); } /* diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index b9acf1e..aa29f36 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -418,8 +418,7 @@ nfs_init(struct vfsconf *vfsp) * Initialize reply list and start timer */ TAILQ_INIT(&nfs_reqq); - - nfs_timer(0); + callout_init(&nfs_callout, 0); nfs_prev_nfsclnt_sy_narg = sysent[SYS_nfsclnt].sy_narg; sysent[SYS_nfsclnt].sy_narg = 2; @@ -435,7 +434,7 @@ int nfs_uninit(struct vfsconf *vfsp) { - untimeout(nfs_timer, (void *)NULL, nfs_timer_handle); + callout_stop(&nfs_callout); sysent[SYS_nfsclnt].sy_narg = nfs_prev_nfsclnt_sy_narg; sysent[SYS_nfsclnt].sy_call = nfs_prev_nfsclnt_sy_call; return (0); diff --git a/sys/rpc/rpcclnt.c b/sys/rpc/rpcclnt.c index 9b0bb05..49ffea0 100644 --- a/sys/rpc/rpcclnt.c +++ b/sys/rpc/rpcclnt.c @@ -284,7 +284,6 @@ rpcclnt_init(void) rpcclnt_timer(&rpcclnt_timer_to); #else /* !__OpenBSD__ */ callout_init(&rpcclnt_callout, 0); - rpcclnt_timer(NULL); #endif /* !__OpenBSD__ */ RPCDEBUG("rpc initialed"); @@ -296,9 +295,8 @@ void rpcclnt_uninit(void) { RPCDEBUG("uninit"); - callout_stop(&rpcclnt_callout); - /* XXX delete sysctl variables? */ + callout_stop(&rpcclnt_callout); } int @@ -1197,6 +1195,9 @@ rpcclnt_request(rpc, mrest, procnum, td, cred, reply) * LAST so timer finds oldest requests first. */ s = splsoftclock(); + if (TAILQ_EMPTY(&rpctask_q)) + callout_reset(&rpcclnt_callout, rpcclnt_ticks, rpcclnt_timer, + NULL); TAILQ_INSERT_TAIL(&rpctask_q, task, r_chain); /* @@ -1238,6 +1239,8 @@ rpcclnt_request(rpc, mrest, procnum, td, cred, reply) */ s = splsoftclock(); TAILQ_REMOVE(&rpctask_q, task, r_chain); + if (TAILQ_EMPTY(&rpctask_q)) + callout_stop(&rpcclnt_callout); splx(s); /* @@ -1475,8 +1478,6 @@ rpcclnt_timer(arg) #ifdef __OpenBSD__ timeout_add(rpcclnt_timer, to, rpcclnt_ticks); -#else - callout_reset(&rpcclnt_callout, rpcclnt_ticks, rpcclnt_timer, NULL); #endif } |