only do nfs rpc callouts if there is work to do.
Submitted by: kan Approved by: alfred
This commit is contained in:
parent
aaf3e5b065
commit
f9955a5f53
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127421
@ -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;
|
||||
|
@ -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 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
|
||||
* 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 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user