]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: Move host quota calculation
authorAndrew Deason <adeason@sinenomine.net>
Tue, 14 Aug 2012 22:25:44 +0000 (17:25 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 27 Feb 2014 14:43:57 +0000 (06:43 -0800)
Calculate this during initialization, not every time we want to use
it.

Reviewed-on: http://gerrit.openafs.org/9710
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 31b518fcf184ba122b6faab54e2e4fa0d37605a3)

Change-Id: Ia4bb30b31e2e3ce25ea16d5932f8f3ae26210c11
Reviewed-on: http://gerrit.openafs.org/10758
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/viced/host.c
src/viced/host.h
src/viced/viced.c

index 4ad35acb27f8aacfb6bc82d3b6eab7ad55e8c042..596223895438296d23f131766d65305c96a68900 100644 (file)
@@ -85,6 +85,7 @@ int rxcon_ident_key;
 int rxcon_client_key;
 
 static struct rx_securityClass *sc = NULL;
+static int h_quota_limit;
 
 /* arguments for PerHost_EnumerateClient enumeration */
 struct enumclient_args {
@@ -1657,18 +1658,8 @@ removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
 static int
 h_threadquota(int waiting)
 {
-    if (lwps > 64) {
-       if (waiting > 5)
-           return 1;
-    } else if (lwps > 32) {
-       if (waiting > 4)
-           return 1;
-    } else if (lwps > 16) {
-       if (waiting > 3)
-           return 1;
-    } else {
-       if (waiting > 2)
-           return 1;
+    if (waiting > h_quota_limit) {
+       return 1;
     }
     return 0;
 }
@@ -2245,8 +2236,11 @@ int  num_lrealms = -1;
 
 /* not reentrant */
 void
-h_InitHostPackage(void)
+h_InitHostPackage(int hquota)
 {
+    osi_Assert(hquota > 0);
+    h_quota_limit = hquota;
+
     memset(&nulluuid, 0, sizeof(afsUUID));
     afsconf_GetLocalCell(confDir, localcellname, PR_MAXNAMELEN);
     if (num_lrealms == -1) {
index fbe31284ff283486588b92bb3ff2cba14a876730..268907e4248c4bbdc4b6a818a62a5350e9d3bd9d 100644 (file)
@@ -239,7 +239,7 @@ extern void h_GetHostNetStats(afs_int32 * a_numHostsP, afs_int32 * a_sameNetOrSu
                  afs_int32 * a_diffSubnetP, afs_int32 * a_diffNetworkP);
 extern int h_NBLock_r(struct host *host);
 extern void h_DumpHosts(void);
-extern void h_InitHostPackage(void);
+extern void h_InitHostPackage(int hquota);
 extern void h_CheckHosts(void );
 extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf);
 extern void h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host * host);
index 6878e31da87395c79fe0ed9f0d39acc9fe8e3a87..13d5d518731ac113de7002be2ae6b15781690a60 100644 (file)
@@ -184,6 +184,7 @@ static int panic_timeout = 2 * 60;
 static int panic_timeout = 30 * 60;
 #endif
 
+static int host_thread_quota;
 int rxpackets = 150;           /* 100 */
 int nSmallVns = 400;           /* 200 */
 int large = 400;               /* 200 */
@@ -1498,6 +1499,16 @@ ParseArgs(int argc, char *argv[])
     else if (lwps < 6)
        lwps = 6;
 
+    if (lwps > 64) {
+       host_thread_quota = 5;
+    } else if (lwps > 32) {
+       host_thread_quota = 4;
+    } else if (lwps > 16) {
+       host_thread_quota = 3;
+    } else {
+       host_thread_quota = 2;
+    }
+
     return (0);
 
 }                              /*ParseArgs */
@@ -2207,7 +2218,7 @@ main(int argc, char *argv[])
     }
 
     init_sys_error_to_et();    /* Set up error table translation */
-    h_InitHostPackage();       /* set up local cellname and realmname */
+    h_InitHostPackage(host_thread_quota); /* set up local cellname and realmname */
     InitCallBack(numberofcbs);
     ClearXStatValues();