#include "DiskIO/WriteRequest.h"
#include "ipc/Messages.h"
#include "ipc/Port.h"
+#include "ipc/StrandCoord.h"
#include "ipc/UdsOp.h"
CBDATA_CLASS_INIT(IpcIoFile);
if (IamDiskProcess()) {
error_ = !DiskerOpen(dbName, flags, mode);
+ if (error_)
+ return;
+
ioRequestor->ioCompletedNotification();
+
+ Ipc::HereIamMessage ann(Ipc::StrandCoord(KidIdentifier, getpid()));
+ ann.strand.tag = dbName;
+ Ipc::TypedMsgHdr message;
+ ann.pack(message);
+ SendMessage(Ipc::coordinatorAddr, message);
+
return;
}
// are refcounted. We up our count once to avoid implicit delete's.
RefCountReference();
+ if (!map && (!UsingSmp() || IamDiskProcess())) {
+ // XXX: polish, validateOptions() has same code
+ const int64_t eLimitHi = 0xFFFFFF; // Core sfileno maximum
+ const int64_t eLimitLo = 0; // dynamic shrinking unsupported
+ const int64_t eWanted = (maximumSize() - HeaderSize)/max_objsize;
+ const int64_t eAllowed = min(max(eLimitLo, eWanted), eLimitHi);
+ map = new DirMap(path, eAllowed);
+ }
+
DiskIOModule *m = DiskIOModule::Find("IpcIo"); // TODO: configurable?
assert(m);
io = m->createStrategy();
repl = createRemovalPolicy(Config.replPolicy);
- // map size is set when shared memory segment is created
- if (!map)
- map = new DirMap(path);
-
validateOptions();
}
if (ps > 0 && (max_objsize % ps != 0))
fatal("Rock store max-size should be a multiple of page size");
- /*
+ /* XXX: should we support resize?
const int64_t eLimitHi = 0xFFFFFF; // Core sfileno maximum
- const int64_t eLimitLo = map.entryLimit(); // dynamic shrinking unsupported
+ const int64_t eLimitLo = map->entryLimit(); // dynamic shrinking unsupported
const int64_t eWanted = (maximumSize() - HeaderSize)/max_objsize;
const int64_t eAllowed = min(max(eLimitLo, eWanted), eLimitHi);
- map.resize(eAllowed); // the map may decide to use an even lower limit
+ map->resize(eAllowed); // the map may decide to use an even lower limit
*/
+ /* XXX: misplaced, map is not yet created
// Note: We could try to shrink max_size now. It is stored in KB so we
// may not be able to make it match the end of the last entry exactly.
const int64_t mapRoundWasteMx = max_objsize*sizeof(long)*8;
debugs(47, 0, "\tdisk space waste: " << totalWaste << " bytes");
debugs(47, 0, "WARNING: Rock store config wastes space.");
}
+ */
if (!repl) {
debugs(47,0, "ERROR: Rock cache_dir[" << index << "] " <<
// not fatal because it can be added later
}
- cur_size = (HeaderSize + max_objsize * map->entryCount()) >> 10;
+ // XXX: misplaced, map is not yet created
+ //cur_size = (HeaderSize + max_objsize * map->entryCount()) >> 10;
}
void
fatalf("Rock cache_dir failed to open db file: %s", filePath);
}
+ if (!map)
+ map = new DirMap(path);
+
cur_size = (HeaderSize + max_objsize * map->entryCount()) >> 10;
// TODO: lower debugging level
Must(!isRegistered);
HereIamMessage ann(StrandCoord(KidIdentifier, getpid()));
-
- // announce that we are responsible for our cache_dir if needed
- // XXX: misplaced
- if (IamDiskProcess()) {
- const int myDisk = KidIdentifier % Config.cacheSwap.n_processes;
- if (const SwapDir *sd = dynamic_cast<const SwapDir*>(INDEXSD(myDisk))) {
- ann.strand.tag = sd->path;
- ann.strand.tag.append("/rock"); // XXX: scope boundary violation
- }
- }
-
TypedMsgHdr message;
ann.pack(message);
SendMessage(coordinatorAddr, message);
Ip::ProbeTransport(); // determine IPv4 or IPv6 capabilities before parsing.
- debugs(0,0, HERE << '1');
- if (IamMasterProcess()) {
- debugs(0,0, HERE << '2');
- new Rock::DirMap("/home/dikk/projects/factory/squid/rock_smp/rock1", 1000);
- new Rock::DirMap("/home/dikk/projects/factory/squid/rock_smp/rock2", 1000);
- new Rock::DirMap("/home/dikk/projects/factory/squid/rock_smp/rock3", 1000);
- }
- debugs(0,0, HERE << '3');
-
parse_err = parseConfigFile(ConfigFile);
Mem::Report();