From 9da217cee811df78f07f47f51ad8202d1b47f812 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Thu, 2 Mar 2006 22:34:27 +0000 Subject: [PATCH] probe-interval-20060302 Make probe_all interval tuneable, although there is no easy way to set it yet. --- src/afs/afs_daemons.c | 26 +++++++++++++------------- src/afs/afs_pioctl.c | 4 ++-- src/afs/afs_prototypes.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index cf64703e1..1a9471b5d 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -46,14 +46,14 @@ afs_int32 afs_gcpags = AFS_GCPAGS; afs_int32 afs_gcpags_procsize = 0; afs_int32 afs_CheckServerDaemonStarted = 0; -#ifdef DEFAULT_PROBE_INTERVAL -afs_int32 PROBE_INTERVAL = DEFAULT_PROBE_INTERVAL; /* overridding during compile */ -#else -afs_int32 PROBE_INTERVAL = 180; /* default to 3 min */ +#ifndef DEFAULT_PROBE_INTERVAL +#define DEFAULT_PROBE_INTERVAL 180 /* default to 3 min */ #endif +afs_int32 afs_probe_interval = DEFAULT_PROBE_INTERVAL; +afs_int32 afs_probe_all_interval = 600; -#define PROBE_WAIT() (1000 * (PROBE_INTERVAL - ((afs_random() & 0x7fffffff) \ - % (PROBE_INTERVAL/2)))) +#define PROBE_WAIT() (1000 * (afs_probe_interval - ((afs_random() & 0x7fffffff) \ + % (afs_probe_interval/2)))) void afs_CheckServerDaemon(void) @@ -75,13 +75,13 @@ afs_CheckServerDaemon(void) } now = osi_Time(); - if (PROBE_INTERVAL + lastCheck <= now) { + if (afs_probe_interval + lastCheck <= now) { afs_CheckServers(1, NULL); /* check down servers */ lastCheck = now = osi_Time(); } - if (600 + last10MinCheck <= now) { - afs_Trace1(afs_iclSetp, CM_TRACE_PROBEUP, ICL_TYPE_INT32, 600); + if (afs_probe_all_interval + last10MinCheck <= now) { + afs_Trace1(afs_iclSetp, CM_TRACE_PROBEUP, ICL_TYPE_INT32, afs_probe_all_interval); afs_CheckServers(0, NULL); last10MinCheck = now = osi_Time(); } @@ -93,9 +93,9 @@ afs_CheckServerDaemon(void) } /* Compute time to next probe. */ - delay = PROBE_INTERVAL + lastCheck; - if (delay > 600 + last10MinCheck) - delay = 600 + last10MinCheck; + delay = afs_probe_interval + lastCheck; + if (delay > afs_probe_all_interval + last10MinCheck) + delay = afs_probe_all_interval + last10MinCheck; delay -= now; if (delay < 1) delay = 1; @@ -197,7 +197,7 @@ afs_Daemon(void) cs_warned = 1; printf("Please install afsd with check server daemon.\n"); } - if (lastNMinCheck + PROBE_INTERVAL < now) { + if (lastNMinCheck + afs_probe_interval < now) { /* only check down servers */ afs_CheckServers(1, NULL); lastNMinCheck = now; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 3cef7451d..852704b05 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1945,12 +1945,12 @@ DECL_PIOCTL(PCheckServers) pcheck = (struct chservinfo *)ain; if (pcheck->tinterval >= 0) { cp = aout; - memcpy(cp, (char *)&PROBE_INTERVAL, sizeof(afs_int32)); + memcpy(cp, (char *)&afs_probe_interval, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); if (pcheck->tinterval > 0) { if (!afs_osi_suser(*acred)) return EACCES; - PROBE_INTERVAL = pcheck->tinterval; + afs_probe_interval = pcheck->tinterval; } return 0; } diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 63069b2d2..e936eff3a 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -268,7 +268,7 @@ extern struct afs_osi_WaitHandle AFS_WaitHandler, AFS_CSWaitHandler; extern afs_int32 afs_gcpags; extern afs_int32 afs_gcpags_procsize; extern afs_int32 afs_CheckServerDaemonStarted; -extern afs_int32 PROBE_INTERVAL; +extern afs_int32 afs_probe_interval; extern void afs_Daemon(void); extern struct brequest *afs_BQueue(register short aopcode, -- 2.39.5