From: Alex Rousskov Date: Wed, 5 Dec 2012 19:39:42 +0000 (-0700) Subject: Use unique map/index paths not only when creating their shared memory segments X-Git-Tag: SQUID_3_5_0_1~444^2~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=300fd2974968ba923d434378c0a5b3dd59329fba;p=thirdparty%2Fsquid.git Use unique map/index paths not only when creating their shared memory segments but also when opening those segments. --- diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 7f06c2fdf1..f9d6efbeea 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -216,7 +216,7 @@ Rock::SwapDir::init() lock(); Must(!map); - map = new DirMap(path); + map = new DirMap(inodeMapPath()); const char *ioModule = needsDiskStrand() ? "IpcIo" : "Blocking"; if (DiskIOModule *m = DiskIOModule::Find(ioModule)) { @@ -233,7 +233,7 @@ Rock::SwapDir::init() theFile->configure(fileConfig); theFile->open(O_RDWR, 0644, this); - dbSlotIndex = shm_old(Ipc::Mem::PageStack)(path); + dbSlotIndex = shm_old(Ipc::Mem::PageStack)(spaceIndexPath()); dbSlots = new (reinterpret_cast(dbSlotIndex.getRaw()) + dbSlotIndex->stackSize()) DbCellHeader[entryLimitAllowed()]; @@ -919,6 +919,22 @@ Rock::SwapDir::statfs(StoreEntry &e) const } +const char * +Rock::SwapDir::inodeMapPath() const { + static String inodesPath; + inodesPath = path; + inodesPath.append("_inodes"); + return inodesPath.termedBuf(); +} + +const char * +Rock::SwapDir::spaceIndexPath() const { + static String spacesPath; + spacesPath = path; + spacesPath.append("_spaces"); + return spacesPath.termedBuf(); +} + namespace Rock { RunnerRegistrationEntry(rrAfterConfig, SwapDirRr); @@ -931,17 +947,13 @@ void Rock::SwapDirRr::create(const RunnerRegistry &) if (const Rock::SwapDir *const sd = dynamic_cast(INDEXSD(i))) { const int64_t capacity = sd->entryLimitAllowed(); - String inodesPath = sd->path; - inodesPath.append("_inodes"); SwapDir::DirMap::Owner *const mapOwner = - SwapDir::DirMap::Init(inodesPath.termedBuf(), capacity); + SwapDir::DirMap::Init(sd->inodeMapPath(), capacity); mapOwners.push_back(mapOwner); - String spacesPath = sd->path; - spacesPath.append("_spaces"); // XXX: remove pool id and counters from PageStack Ipc::Mem::Owner *const dbSlotsOwner = - shm_new(Ipc::Mem::PageStack)(spacesPath.termedBuf(), + shm_new(Ipc::Mem::PageStack)(sd->spaceIndexPath(), i, capacity, sizeof(DbCellHeader)); dbSlotsOwners.push_back(dbSlotsOwner); diff --git a/src/fs/rock/RockSwapDir.h b/src/fs/rock/RockSwapDir.h index 50352aa015..60c5451733 100644 --- a/src/fs/rock/RockSwapDir.h +++ b/src/fs/rock/RockSwapDir.h @@ -38,6 +38,11 @@ public: virtual void create(); virtual void parse(int index, char *path); + // temporary path to the shared memory map of first slots of cached entries + const char *inodeMapPath() const; + // temporary path to the shared memory stack of free slots + const char *spaceIndexPath() const; + int64_t entryLimitHigh() const { return SwapFilenMax; } ///< Core limit int64_t entryLimitAllowed() const;