@@ -73,7 +73,8 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemNewT, Config config)
7373 config_.accessConfig.getNumBuckets()),
7474 nullptr,
7575 ShmSegmentOpts(config_.accessConfig.getPageSize(),
76- false, config_.usePosixShm))
76+ false,
77+ config_.usePosixShm))
7778 .addr,
7879 compressor_,
7980 [this](Item* it) -> WriteHandle { return acquire (it); })),
@@ -85,7 +86,8 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemNewT, Config config)
8586 config_.chainedItemAccessConfig.getNumBuckets()),
8687 nullptr,
8788 ShmSegmentOpts(config_.accessConfig.getPageSize(),
88- false, config_.usePosixShm))
89+ false,
90+ config_.usePosixShm))
8991 .addr,
9092 compressor_,
9193 [this](Item* it) -> WriteHandle { return acquire (it); })),
@@ -102,7 +104,7 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemNewT, Config config)
102104 config_.isNvmCacheTruncateAllocSizeEnabled ()} {
103105 initCommon (false );
104106 shmManager_->removeShm (detail::kShmInfoName ,
105- PosixSysVSegmentOpts (config_.usePosixShm ));
107+ PosixSysVSegmentOpts (config_.usePosixShm ));
106108}
107109
108110template <typename CacheTrait>
@@ -120,15 +122,19 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemAttachT, Config config)
120122 accessContainer_(std::make_unique<AccessContainer>(
121123 deserializer_->deserialize<AccessSerializationType>(),
122124 config_.accessConfig,
123- shmManager_->attachShm(detail::kShmHashTableName , nullptr ,
124- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
125+ shmManager_->attachShm(
126+ detail::kShmHashTableName ,
127+ nullptr ,
128+ ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
125129 compressor_,
126130 [this](Item* it) -> WriteHandle { return acquire (it); })),
127131 chainedItemAccessContainer_(std::make_unique<AccessContainer>(
128132 deserializer_->deserialize<AccessSerializationType>(),
129133 config_.chainedItemAccessConfig,
130- shmManager_->attachShm(detail::kShmChainedItemHashTableName , nullptr ,
131- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
134+ shmManager_->attachShm(
135+ detail::kShmChainedItemHashTableName ,
136+ nullptr ,
137+ ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
132138 compressor_,
133139 [this](Item* it) -> WriteHandle { return acquire (it); })),
134140 chainedItemLocks_(config_.chainedItemsLockPower,
@@ -150,7 +156,7 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemAttachT, Config config)
150156 // this info shm segment here and the new info shm segment's size is larger
151157 // than this one, creating new one will fail.
152158 shmManager_->removeShm (detail::kShmInfoName ,
153- PosixSysVSegmentOpts (config_.usePosixShm ));
159+ PosixSysVSegmentOpts (config_.usePosixShm ));
154160}
155161
156162template <typename CacheTrait>
@@ -291,8 +297,9 @@ void CacheAllocator<CacheTrait>::initWorkers() {
291297
292298template <typename CacheTrait>
293299std::unique_ptr<Deserializer> CacheAllocator<CacheTrait>::createDeserializer() {
294- auto infoAddr = shmManager_->attachShm (detail::kShmInfoName , nullptr ,
295- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm ));
300+ auto infoAddr = shmManager_->attachShm (
301+ detail::kShmInfoName , nullptr ,
302+ ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm ));
296303 return std::make_unique<Deserializer>(
297304 reinterpret_cast <uint8_t *>(infoAddr.addr ),
298305 reinterpret_cast <uint8_t *>(infoAddr.addr ) + infoAddr.size );
@@ -3157,8 +3164,10 @@ void CacheAllocator<CacheTrait>::saveRamCache() {
31573164 ShmSegmentOpts opts;
31583165 opts.typeOpts = PosixSysVSegmentOpts (config_.usePosixShm );
31593166
3160- void * infoAddr = shmManager_->createShm (detail::kShmInfoName , ioBuf->length (),
3161- nullptr , opts).addr ;
3167+ void * infoAddr =
3168+ shmManager_
3169+ ->createShm (detail::kShmInfoName , ioBuf->length (), nullptr , opts)
3170+ .addr ;
31623171 Serializer serializer (reinterpret_cast <uint8_t *>(infoAddr),
31633172 reinterpret_cast <uint8_t *>(infoAddr) + ioBuf->length ());
31643173 serializer.writeToBuffer (std::move (ioBuf));
@@ -3513,8 +3522,8 @@ bool CacheAllocator<CacheTrait>::stopReaper(std::chrono::seconds timeout) {
35133522}
35143523
35153524template <typename CacheTrait>
3516- bool CacheAllocator<CacheTrait>::cleanupStrayShmSegments(
3517- const std::string& cacheDir, bool posix /* TODO(SHM_FILE): const std::vector<CacheMemoryTierConfig>& config */ ) {
3525+ bool CacheAllocator<
3526+ CacheTrait>::cleanupStrayShmSegments( const std::string& cacheDir, bool posix /* TODO(SHM_FILE): const std::vector<CacheMemoryTierConfig>& config */ ) {
35183527 if (util::getStatIfExists (cacheDir, nullptr ) && util::isDir (cacheDir)) {
35193528 try {
35203529 // cache dir exists. clean up only if there are no other processes
@@ -3537,7 +3546,8 @@ bool CacheAllocator<CacheTrait>::cleanupStrayShmSegments(
35373546 // TODO(SHM_FILE): try to nuke segments of differente types (which require
35383547 // extra info)
35393548 // for (auto &tier : config) {
3540- // ShmManager::removeByName(cacheDir, tierShmName, config_.memoryTiers[i].opts);
3549+ // ShmManager::removeByName(cacheDir, tierShmName,
3550+ // config_.memoryTiers[i].opts);
35413551 // }
35423552 }
35433553 return true ;
0 commit comments