Skip to content
12 changes: 6 additions & 6 deletions src/MemStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ MemStore::init()
}
}

freeSlots = shm_old(Ipc::Mem::PageStack)(SpaceLabel);
extras = shm_old(Extras)(ExtrasLabel);
freeSlots = shm_old(Ipc::Mem::PageStack)(SpaceLabel, "M001");
extras = shm_old(Extras)(ExtrasLabel, "M002");

Must(!map);
map = new MemStoreMap(SBuf(MapLabel));
map = new MemStoreMap(SBuf(MapLabel), "M003");
map->cleaner = this;
}

Expand Down Expand Up @@ -1047,11 +1047,11 @@ MemStoreRr::create()
spaceConfig.capacity = entryLimit;
spaceConfig.createFull = true; // all pages are initially available
Must(!spaceOwner);
spaceOwner = shm_new(Ipc::Mem::PageStack)(SpaceLabel, spaceConfig);
spaceOwner = shm_new(Ipc::Mem::PageStack)(SpaceLabel, "M001", spaceConfig);
Must(!mapOwner);
mapOwner = MemStoreMap::Init(SBuf(MapLabel), entryLimit);
mapOwner = MemStoreMap::Init(SBuf(MapLabel), "M003", entryLimit);
Must(!extrasOwner);
extrasOwner = shm_new(MemStoreMapExtras)(ExtrasLabel, entryLimit);
extrasOwner = shm_new(MemStoreMapExtras)(ExtrasLabel, "M002", entryLimit);
}

MemStoreRr::~MemStoreRr()
Expand Down
4 changes: 2 additions & 2 deletions src/Transients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Transients::init()
assert(entryLimit > 0);

Must(!map);
map = new TransientsMap(MapLabel());
map = new TransientsMap(SBuf(MapLabel()), "M011");
map->cleaner = this;
map->disableHitValidation(); // Transients lacks slices to validate

Expand Down Expand Up @@ -415,7 +415,7 @@ TransientsRr::create()
return; // no SMP configured or a misconfiguration

Must(!mapOwner);
mapOwner = TransientsMap::Init(MapLabel(), entryLimit);
mapOwner = TransientsMap::Init(SBuf(MapLabel()), "M011", entryLimit);
}

TransientsRr::~TransientsRr()
Expand Down
7 changes: 4 additions & 3 deletions src/fs/rock/RockRebuild.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ inline typename T::Owner *
createOwner(const char *dirPath, const char *sfx, const int64_t limit, const bool resuming)
{
auto id = Ipc::Mem::Segment::Name(SBuf(dirPath), sfx);
return resuming ? Ipc::Mem::Owner<T>::Old(id.c_str()) : shm_new(T)(id.c_str(), limit);
const char *machineId = "M008";
return resuming ? Ipc::Mem::Owner<T>::Old(id.c_str(), machineId) : shm_new(T)(id.c_str(), machineId, limit);
}

Rock::LoadingParts::LoadingParts(const SwapDir &dir, const bool resuming):
Expand Down Expand Up @@ -258,7 +259,7 @@ Rock::Rebuild::Stats::Path(const char *dirPath)
Ipc::Mem::Owner<Rock::Rebuild::Stats>*
Rock::Rebuild::Stats::Init(const SwapDir &dir)
{
return shm_new(Stats)(Path(dir.path).c_str());
return shm_new(Stats)(Path(dir.path).c_str(), "M008");
}

bool
Expand Down Expand Up @@ -286,7 +287,7 @@ Rock::Rebuild::Start(SwapDir &dir)
return false;
}

const auto stats = shm_old(Rebuild::Stats)(Stats::Path(dir.path).c_str());
const auto stats = shm_old(Rebuild::Stats)(Stats::Path(dir.path).c_str(), "M008");
if (stats->completed(dir)) {
debugs(47, 2, "already indexed cache_dir #" <<
dir.index << " from " << dir.filePath);
Expand Down
8 changes: 4 additions & 4 deletions src/fs/rock/RockSwapDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ Rock::SwapDir::init()
// are refcounted. We up our count once to avoid implicit delete's.
lock();

freeSlots = shm_old(Ipc::Mem::PageStack)(freeSlotsPath());
freeSlots = shm_old(Ipc::Mem::PageStack)(freeSlotsPath(), "M009");

Must(!map);
map = new DirMap(inodeMapPath());
map = new DirMap(inodeMapPath(), "M009");
map->cleaner = this;

const char *ioModule = needsDiskStrand() ? "IpcIo" : "Blocking";
Expand Down Expand Up @@ -1127,7 +1127,7 @@ void Rock::SwapDirRr::create()
const int64_t capacity = sd->slotLimitActual();

SwapDir::DirMap::Owner *const mapOwner =
SwapDir::DirMap::Init(sd->inodeMapPath(), capacity);
SwapDir::DirMap::Init(sd->inodeMapPath(), "M009", capacity);
mapOwners.push_back(mapOwner);

// TODO: somehow remove pool id and counters from PageStack?
Expand All @@ -1137,7 +1137,7 @@ void Rock::SwapDirRr::create()
config.capacity = capacity;
config.createFull = false; // Rebuild finds and pushes free slots
Ipc::Mem::Owner<Ipc::Mem::PageStack> *const freeSlotsOwner =
shm_new(Ipc::Mem::PageStack)(sd->freeSlotsPath(), config);
shm_new(Ipc::Mem::PageStack)(sd->freeSlotsPath(), "M009", config);
freeSlotsOwners.push_back(freeSlotsOwner);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/ipc/MemMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
#include "store_key_md5.h"
#include "tools.h"

Ipc::MemMap::MemMap(const char *const aPath) :
Ipc::MemMap::MemMap(const char *const aPath, const char *const machineId) :
cleaner(nullptr),
path(aPath),
shared(shm_old(Shared)(aPath))
shared(shm_old(Shared)(aPath, machineId))
{
assert(shared->limit > 0); // we should not be created otherwise
debugs(54, 5, "attached map [" << path << "] created: " <<
shared->limit);
}

Ipc::MemMap::Owner *
Ipc::MemMap::Init(const char *const path, const int limit, const size_t extrasSize)
Ipc::MemMap::Init(const char *const path, const char *const machineId, const int limit, const size_t extrasSize)
{
assert(limit > 0); // we should not be created otherwise
Owner *const owner = shm_new(Shared)(path, limit, extrasSize);
Owner *const owner = shm_new(Shared)(path, machineId, limit, extrasSize);
debugs(54, 5, "new map [" << path << "] created: " << limit);
return owner;
}

Ipc::MemMap::Owner *
Ipc::MemMap::Init(const char *const path, const int limit)
Ipc::MemMap::Init(const char *const path, const char *const machineId, const int limit)
{
return Init(path, limit, 0);
return Init(path, machineId, limit, 0);
}

Ipc::MemMap::Slot *
Expand Down
5 changes: 3 additions & 2 deletions src/ipc/MemMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class MemMap
typedef Mem::Owner<Shared> Owner;

/// initialize shared memory
static Owner *Init(const char *const path, const int limit);
static Owner *Init(const char *const path, const char *const machineId, const int limit, const size_t extrasSize);
static Owner *Init(const char *const path, const char *const machineId, const int limit);

MemMap(const char *const aPath);
MemMap(const char *const aPath, const char *const machineId);

/// finds, locks and return a slot for an empty key position,
/// erasing the old entry (if any)
Expand Down
24 changes: 12 additions & 12 deletions src/ipc/Queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ Ipc::FewToFewBiQueue::Init(const String &id, const int groupASize, const int gro

Ipc::FewToFewBiQueue::FewToFewBiQueue(const String &id, const Group aLocalGroup, const int aLocalProcessId):
BaseMultiQueue(aLocalProcessId),
metadata(shm_old(Metadata)(MetadataId(id).termedBuf())),
queues(shm_old(OneToOneUniQueues)(QueuesId(id).termedBuf())),
readers(shm_old(QueueReaders)(ReadersId(id).termedBuf())),
metadata(shm_old(Metadata)(MetadataId(id).termedBuf(), "M004")),
queues(shm_old(OneToOneUniQueues)(QueuesId(id).termedBuf(), "M005")),
readers(shm_old(QueueReaders)(ReadersId(id).termedBuf(), "M006")),
theLocalGroup(aLocalGroup)
{
Must(queues->theCapacity == metadata->theGroupASize * metadata->theGroupBSize * 2);
Expand Down Expand Up @@ -349,9 +349,9 @@ Ipc::FewToFewBiQueue::Metadata::Metadata(const int aGroupASize, const int aGroup
}

Ipc::FewToFewBiQueue::Owner::Owner(const String &id, const int groupASize, const int groupAIdOffset, const int groupBSize, const int groupBIdOffset, const unsigned int maxItemSize, const int capacity):
metadataOwner(shm_new(Metadata)(MetadataId(id).termedBuf(), groupASize, groupAIdOffset, groupBSize, groupBIdOffset)),
queuesOwner(shm_new(OneToOneUniQueues)(QueuesId(id).termedBuf(), groupASize*groupBSize*2, maxItemSize, capacity)),
readersOwner(shm_new(QueueReaders)(ReadersId(id).termedBuf(), groupASize+groupBSize))
metadataOwner(shm_new(Metadata)(MetadataId(id).termedBuf(), "M004", groupASize, groupAIdOffset, groupBSize, groupBIdOffset)),
queuesOwner(shm_new(OneToOneUniQueues)(QueuesId(id).termedBuf(), "M005", groupASize*groupBSize*2, maxItemSize, capacity)),
readersOwner(shm_new(QueueReaders)(ReadersId(id).termedBuf(), "M006", groupASize+groupBSize))
{
}

Expand All @@ -372,9 +372,9 @@ Ipc::MultiQueue::Init(const String &id, const int processCount, const int proces

Ipc::MultiQueue::MultiQueue(const String &id, const int localProcessId):
BaseMultiQueue(localProcessId),
metadata(shm_old(Metadata)(MetadataId(id).termedBuf())),
queues(shm_old(OneToOneUniQueues)(QueuesId(id).termedBuf())),
readers(shm_old(QueueReaders)(ReadersId(id).termedBuf()))
metadata(shm_old(Metadata)(MetadataId(id).termedBuf(), "M004")),
queues(shm_old(OneToOneUniQueues)(QueuesId(id).termedBuf(), "M005")),
readers(shm_old(QueueReaders)(ReadersId(id).termedBuf(), "M006"))
{
Must(queues->theCapacity == metadata->theProcessCount * metadata->theProcessCount);
Must(readers->theCapacity == metadata->theProcessCount);
Expand Down Expand Up @@ -451,9 +451,9 @@ Ipc::MultiQueue::Metadata::Metadata(const int aProcessCount, const int aProcessI
}

Ipc::MultiQueue::Owner::Owner(const String &id, const int processCount, const int processIdOffset, const unsigned int maxItemSize, const int capacity):
metadataOwner(shm_new(Metadata)(MetadataId(id).termedBuf(), processCount, processIdOffset)),
queuesOwner(shm_new(OneToOneUniQueues)(QueuesId(id).termedBuf(), processCount*processCount, maxItemSize, capacity)),
readersOwner(shm_new(QueueReaders)(ReadersId(id).termedBuf(), processCount))
metadataOwner(shm_new(Metadata)(MetadataId(id).termedBuf(), "M004", processCount, processIdOffset)),
queuesOwner(shm_new(OneToOneUniQueues)(QueuesId(id).termedBuf(), "M005", processCount*processCount, maxItemSize, capacity)),
readersOwner(shm_new(QueueReaders)(ReadersId(id).termedBuf(), "M006", processCount))
{
}

Expand Down
16 changes: 8 additions & 8 deletions src/ipc/StoreMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ StoreMapFileNosId(const SBuf &path)
}

Ipc::StoreMap::Owner *
Ipc::StoreMap::Init(const SBuf &path, const int sliceLimit)
Ipc::StoreMap::Init(const SBuf &path, const char *const machineId, const int sliceLimit)
{
assert(sliceLimit > 0); // we should not be created otherwise
const int anchorLimit = min(sliceLimit, static_cast<int>(SwapFilenMax));
Owner *owner = new Owner;
owner->fileNos = shm_new(FileNos)(StoreMapFileNosId(path).c_str(), anchorLimit);
owner->anchors = shm_new(Anchors)(StoreMapAnchorsId(path).c_str(), anchorLimit);
owner->slices = shm_new(Slices)(StoreMapSlicesId(path).c_str(), sliceLimit);
owner->fileNos = shm_new(FileNos)(StoreMapFileNosId(path).c_str(), machineId, anchorLimit);
owner->anchors = shm_new(Anchors)(StoreMapAnchorsId(path).c_str(), machineId, anchorLimit);
owner->slices = shm_new(Slices)(StoreMapSlicesId(path).c_str(), machineId, sliceLimit);
debugs(54, 5, "created " << path << " with " << anchorLimit << '+' << sliceLimit);
return owner;
}

Ipc::StoreMap::StoreMap(const SBuf &aPath): cleaner(nullptr), path(aPath),
fileNos(shm_old(FileNos)(StoreMapFileNosId(path).c_str())),
anchors(shm_old(Anchors)(StoreMapAnchorsId(path).c_str())),
slices(shm_old(Slices)(StoreMapSlicesId(path).c_str())),
Ipc::StoreMap::StoreMap(const SBuf &aPath, const char *const machineId): cleaner(nullptr), path(aPath),
fileNos(shm_old(FileNos)(StoreMapFileNosId(path).c_str(), machineId)),
anchors(shm_old(Anchors)(StoreMapAnchorsId(path).c_str(), machineId)),
slices(shm_old(Slices)(StoreMapSlicesId(path).c_str(), machineId)),
hitValidation(true)
{
debugs(54, 5, "attached " << path << " with " <<
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/StoreMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ class StoreMap
};

/// initialize shared memory
static Owner *Init(const SBuf &path, const int slotLimit);
static Owner *Init(const SBuf &path, const char *const machineId, const int slotLimit);

StoreMap(const SBuf &aPath);
StoreMap(const SBuf &aPath, const char *const machineId);

/// computes map entry anchor position for a given entry key
sfileno fileNoByKey(const cache_key *const key) const;
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/mem/PagePool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Ipc::Mem::PagePool::Init(const char *const shmId, const Ipc::Mem::PoolId stackId
config.pageSize = pageSize; // the pages are stored in Ipc::Mem::Pages
config.capacity = capacity;
config.createFull = true; // all pages are initially available
return shm_new(PageStack)(shmId, config);
return shm_new(PageStack)(shmId, "M007", config);
}

Ipc::Mem::PagePool::PagePool(const char *const id):
pageIndex(shm_old(PageStack)(id)),
pageIndex(shm_old(PageStack)(id, "M007")),
theLevels(reinterpret_cast<Levels_t *>(
reinterpret_cast<char *>(pageIndex.getRaw()) +
pageIndex->stackSize() + pageIndex->levelsPaddingSize())),
Expand Down
Loading
Loading