Must(!owner);
// XXX: make capacity configurable
owner = Ipc::FewToFewBiQueue::Init(ShmLabel, Config.workers, 1,
- Config.cacheSwap.n_configured,
+ Config.cacheSwap.n_strands,
1 + Config.workers, sizeof(IpcIoMsg),
1024);
}
tests/testHttpRequestMethod.h \
tests/testHttpRequestMethod.cc \
tests/testMain.cc \
+ tests/stub_DiskIOModule.cc \
tests/stub_main_cc.cc \
tests/stub_ipc_Forwarder.cc \
time.cc \
SwapDir::SwapDir(char const *aType): theType(aType),
max_size(0),
- path(NULL), index(-1), min_objsize(0), max_objsize (-1),
+ path(NULL), index(-1), disker(-1), min_objsize(0), max_objsize (-1),
repl(NULL), removals(0), scanned(0),
cleanLog(NULL)
{
return true;
// we are inside a disker dedicated to this disk
- if (IamDiskProcess() && index == (KidIdentifier-1 - Config.workers))
+ if (KidIdentifier == disker)
return true;
return false; // Coordinator, wrong disker, etc.
public:
char *path;
int index; /* This entry's index into the swapDirs array */
+ int disker; ///< disker kid id dedicated to this SwapDir or -1
int64_t min_objsize;
int64_t max_objsize;
RemovalPolicy *repl;
#endif
#include "ConfigParser.h"
#include "CpuAffinityMap.h"
+#include "DiskIO/DiskIOModule.h"
#include "eui/Config.h"
#if USE_SQUID_ESI
#include "esi/Parser.h"
/* 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);
+ }
}
if (Debug::rotateNumber < 0) {
++swap->n_configured;
- if (sd->needsDiskStrand())
- ++swap->n_strands;
-
/* Update the max object size */
update_maxobjsize();
}
Must(!map);
map = new DirMap(path);
- const char *ioModule = UsingSmp() ? "IpcIo" : "Blocking";
+ const char *ioModule = needsDiskStrand() ? "IpcIo" : "Blocking";
if (DiskIOModule *m = DiskIOModule::Find(ioModule)) {
debugs(47,2, HERE << "Using DiskIO module: " << ioModule);
io = m->createStrategy();
bool
Rock::SwapDir::needsDiskStrand() const
{
- return true;
+ const bool wontEvenWorkWithoutDisker = Config.workers > 1;
+ const bool wouldWorkBetterWithDisker = DiskIOModule::Find("IpcIo");
+ return InDaemonMode() && (wontEvenWorkWithoutDisker ||
+ wouldWorkBetterWithDisker);
}
void
}
// add Kid records for all disk processes
- // (XXX: some cache_dirs do not need this)
- for (int i = 0; i < Config.cacheSwap.n_configured; ++i) {
+ for (int i = 0; i < Config.cacheSwap.n_strands; ++i) {
snprintf(kid_name, sizeof(kid_name), "(squid-disk-%d)", (int)(storage.size()+1));
storage.push_back(Kid(kid_name));
}