mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-03 23:28:58 +00:00
nfsd: Reduce callouts rate.
Before this callouts were scheduled twice a seconds even if nfsd was never used. This reduces the rate to ~1Hz and only after nfsd first started. MFC after: 2 weeks
This commit is contained in:
parent
51b461b3db
commit
3455c738ac
|
@ -67,12 +67,10 @@ struct nfsstatsv1 nfsstatsv1;
|
|||
int nfs_numnfscbd = 0;
|
||||
int nfscl_debuglevel = 0;
|
||||
char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
|
||||
struct callout newnfsd_callout;
|
||||
int nfsrv_lughashsize = 100;
|
||||
struct mtx nfsrv_dslock_mtx;
|
||||
struct nfsdevicehead nfsrv_devidhead;
|
||||
volatile int nfsrv_devidcnt = 0;
|
||||
void (*nfsd_call_servertimer)(void) = NULL;
|
||||
void (*ncl_call_invalcaches)(struct vnode *) = NULL;
|
||||
vop_advlock_t *nfs_advlock_p = NULL;
|
||||
vop_reclaim_t *nfs_reclaim_p = NULL;
|
||||
|
@ -399,27 +397,6 @@ newnfs_getcred(void)
|
|||
return (cred);
|
||||
}
|
||||
|
||||
/*
|
||||
* Nfs timer routine
|
||||
* Call the nfsd's timer function once/sec.
|
||||
*/
|
||||
void
|
||||
newnfs_timer(void *arg)
|
||||
{
|
||||
static time_t lasttime = 0;
|
||||
/*
|
||||
* Call the server timer, if set up.
|
||||
* The argument indicates if it is the next second and therefore
|
||||
* leases should be checked.
|
||||
*/
|
||||
if (lasttime != NFSD_MONOSEC) {
|
||||
lasttime = NFSD_MONOSEC;
|
||||
if (nfsd_call_servertimer != NULL)
|
||||
(*nfsd_call_servertimer)();
|
||||
}
|
||||
callout_reset(&newnfsd_callout, nfscl_ticks, newnfs_timer, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sleep for a short period of time unless errval == NFSERR_GRACE, where
|
||||
* the sleep should be for 5 seconds.
|
||||
|
@ -895,7 +872,6 @@ nfscommon_modevent(module_t mod, int type, void *data)
|
|||
MTX_DEF);
|
||||
mtx_init(&nfsrv_dslock_mtx, "nfs4ds", NULL, MTX_DEF);
|
||||
TAILQ_INIT(&nfsrv_devidhead);
|
||||
callout_init(&newnfsd_callout, 1);
|
||||
newnfs_init();
|
||||
nfsd_call_nfscommon = nfssvc_nfscommon;
|
||||
loaded = 1;
|
||||
|
@ -909,7 +885,6 @@ nfscommon_modevent(module_t mod, int type, void *data)
|
|||
}
|
||||
|
||||
nfsd_call_nfscommon = NULL;
|
||||
callout_drain(&newnfsd_callout);
|
||||
/* Clean out the name<-->id cache. */
|
||||
nfsrv_cleanusergroup();
|
||||
/* and get rid of the mutexes */
|
||||
|
|
|
@ -930,7 +930,6 @@ newnfs_init(void)
|
|||
* Initialize reply list and start timer
|
||||
*/
|
||||
TAILQ_INIT(&nfsd_reqq);
|
||||
NFS_TIMERINIT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -431,7 +431,6 @@ int nfs_catnap(int, int, const char *);
|
|||
struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
|
||||
int nfsvno_pathconf(vnode_t, int, long *, struct ucred *, NFSPROC_T *);
|
||||
int nfsrv_atroot(vnode_t, uint64_t *);
|
||||
void newnfs_timer(void *);
|
||||
int nfs_supportsnfsv4acls(vnode_t);
|
||||
|
||||
/* nfs_commonacl.c */
|
||||
|
|
|
@ -776,12 +776,6 @@ void nfsrvd_rcv(struct socket *, void *, int);
|
|||
#define NFSCNHASH(c, v)
|
||||
#define NCHNAMLEN 9999999
|
||||
|
||||
/*
|
||||
* These macros are defined to initialize and set the timer routine.
|
||||
*/
|
||||
#define NFS_TIMERINIT \
|
||||
newnfs_timer(NULL)
|
||||
|
||||
/*
|
||||
* Handle SMP stuff:
|
||||
*/
|
||||
|
|
|
@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#include <fs/nfs/nfsport.h>
|
||||
#include <security/mac/mac_framework.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/hash.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
@ -60,7 +61,6 @@ extern int nfsrv_useacl;
|
|||
extern int newnfs_numnfsd;
|
||||
extern struct mount nfsv4root_mnt;
|
||||
extern struct nfsrv_stablefirst nfsrv_stablefirst;
|
||||
extern void (*nfsd_call_servertimer)(void);
|
||||
extern SVCPOOL *nfsrvd_pool;
|
||||
extern struct nfsv4lock nfsd_suspend_lock;
|
||||
extern struct nfsclienthashhead *nfsclienthash;
|
||||
|
@ -97,6 +97,7 @@ static char nfsd_master_comm[MAXCOMLEN + 1];
|
|||
static struct timeval nfsd_master_start;
|
||||
static uint32_t nfsv4_sysid = 0;
|
||||
static fhandle_t zerofh;
|
||||
struct callout nfsd_callout;
|
||||
|
||||
static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
|
||||
struct ucred *);
|
||||
|
@ -3530,6 +3531,14 @@ nfsd_mntinit(void)
|
|||
nfsv4root_mnt.mnt_lazyvnodelistsize = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nfsd_timer(void *arg)
|
||||
{
|
||||
|
||||
nfsrv_servertimer();
|
||||
callout_reset_sbt(&nfsd_callout, SBT_1S, SBT_1S, nfsd_timer, NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a vnode for a file handle, without checking exports, etc.
|
||||
*/
|
||||
|
@ -3771,6 +3780,7 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap)
|
|||
nfsdarg.mdspathlen = 0;
|
||||
nfsdarg.mirrorcnt = 1;
|
||||
}
|
||||
nfsd_timer(NULL);
|
||||
error = nfsrvd_nfsd(td, &nfsdarg);
|
||||
free(nfsdarg.addr, M_TEMP);
|
||||
free(nfsdarg.dnshost, M_TEMP);
|
||||
|
@ -7033,6 +7043,7 @@ nfsd_modevent(module_t mod, int type, void *data)
|
|||
mtx_init(&nfsrv_dontlistlock_mtx, "nfs4dnl", NULL, MTX_DEF);
|
||||
mtx_init(&nfsrv_recalllock_mtx, "nfs4rec", NULL, MTX_DEF);
|
||||
lockinit(&nfsv4root_mnt.mnt_explock, PVFS, "explock", 0, 0);
|
||||
callout_init(&nfsd_callout, 1);
|
||||
nfsrvd_initcache();
|
||||
nfsd_init();
|
||||
NFSD_LOCK();
|
||||
|
@ -7043,7 +7054,6 @@ nfsd_modevent(module_t mod, int type, void *data)
|
|||
vn_deleg_ops.vndeleg_recall = nfsd_recalldelegation;
|
||||
vn_deleg_ops.vndeleg_disable = nfsd_disabledelegation;
|
||||
#endif
|
||||
nfsd_call_servertimer = nfsrv_servertimer;
|
||||
nfsd_call_nfsd = nfssvc_nfsd;
|
||||
loaded = 1;
|
||||
break;
|
||||
|
@ -7058,8 +7068,8 @@ nfsd_modevent(module_t mod, int type, void *data)
|
|||
vn_deleg_ops.vndeleg_recall = NULL;
|
||||
vn_deleg_ops.vndeleg_disable = NULL;
|
||||
#endif
|
||||
nfsd_call_servertimer = NULL;
|
||||
nfsd_call_nfsd = NULL;
|
||||
callout_drain(&nfsd_callout);
|
||||
|
||||
/* Clean out all NFSv4 state. */
|
||||
nfsrv_throwawayallstate(curthread);
|
||||
|
|
Loading…
Reference in a new issue