On 29/09/11 12:06, Dmitry Kurochkin wrote:
Before the change, a disker process was started for each configured
cache_dir.  But not all cache_dirs need a disker: only Rock store
requires one when running in SMP mode.  There was some existing code
to avoid starting useless diskers (see SwapDir::needsDiskStrand and
Config.cacheSwap.n_strands) but it was not complete.  The patch fixes
this issue.

<snip>
--- src/cache_cf.cc
+++ src/cache_cf.cc
@@ -56,6 +56,7 @@
  #endif
  #include "ConfigParser.h"
  #include "CpuAffinityMap.h"
+#include "DiskIO/DiskIOModule.h"
  #include "eui/Config.h"
  #if USE_SQUID_ESI
  #include "esi/Parser.h"
@@ -599,6 +600,12 @@ configDoConfigure(void)
          /* Memory-only cache probably in effect. */
          /* turn off the cache rebuild delays... */
          StoreController::store_dirs_rebuilding = 0;
+    } else if (InDaemonMode()) { // no diskers in non-daemon mode
+        for (int i = 0; i<  Config.cacheSwap.n_configured; ++i) {
+            const RefCount<SwapDir>  sd = Config.cacheSwap.swapDirs[i];
+            if (sd->needsDiskStrand())
+                sd->disker = Config.workers + ++Config.cacheSwap.n_strands;

Please wrap that ++ operation in () to make it a little more readable and less likely to get mangled later by any mistakes or automatics.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.15
  Beta testers wanted for 3.2.0.12

Reply via email to