]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
probe-interval-20060302
authorJim Rees <rees@umich.edu>
Thu, 2 Mar 2006 22:34:27 +0000 (22:34 +0000)
committerJim Rees <rees@umich.edu>
Thu, 2 Mar 2006 22:34:27 +0000 (22:34 +0000)
Make probe_all interval tuneable, although there is no easy way to set it yet.

src/afs/afs_daemons.c
src/afs/afs_pioctl.c
src/afs/afs_prototypes.h

index cf64703e1098d52fb0a6eb1dbc46f72be89210e7..1a9471b5dabef0c821b307c491543094e950afa8 100644 (file)
@@ -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;
index 3cef7451d9edcd96b5c3178d65c3b81cedfaacb3..852704b056915c54e686b0e20e4cf5a1f4ebae85 100644 (file)
@@ -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;
        }
index 63069b2d2b64eac09230f69c93c5bef115ac7b95..e936eff3ac44f6fb7d3a7addfb33ba6111496a49 100644 (file)
@@ -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,