diff options
Diffstat (limited to 'src/zenstore/compactcas.cpp')
| -rw-r--r-- | src/zenstore/compactcas.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index fe31ad759..63158f6de 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -147,6 +147,7 @@ CasContainerStrategy::Initialize(const std::filesystem::path& RootDirectory, CasStore::InsertResult CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const IoHash& ChunkHash) { + ZEN_TRACE_CPU("CasContainer::InsertChunk"); { RwLock::SharedLockScope _(m_LocationMapLock); if (m_LocationMap.contains(ChunkHash)) @@ -192,6 +193,8 @@ CasContainerStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash) IoBuffer CasContainerStrategy::FindChunk(const IoHash& ChunkHash) { + ZEN_TRACE_CPU("CasContainer::FindChunk"); + RwLock::SharedLockScope _(m_LocationMapLock); auto KeyIt = m_LocationMap.find(ChunkHash); if (KeyIt == m_LocationMap.end()) @@ -418,6 +421,8 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) LocationMap_t LocationMap; BlockStore::ReclaimSnapshotState BlockStoreState; { + ZEN_TRACE_CPU("CasContainer::CollectGarbage::State"); + RwLock::SharedLockScope ___(m_LocationMapLock); Stopwatch Timer; const auto ____ = MakeGuard([&Timer, &WriteBlockTimeUs, &WriteBlockLongestTimeUs] { @@ -445,19 +450,22 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) KeepChunkIndexes.reserve(TotalChunkCount); ChunkIndexToChunkHash.reserve(TotalChunkCount); - GcCtx.FilterCids(TotalChunkHashes, [&](const IoHash& ChunkHash, bool Keep) { - auto KeyIt = LocationMap.find(ChunkHash); - const BlockStoreDiskLocation& DiskLocation = KeyIt->second; - BlockStoreLocation Location = DiskLocation.Get(m_PayloadAlignment); - size_t ChunkIndex = ChunkLocations.size(); - - ChunkLocations.push_back(Location); - ChunkIndexToChunkHash[ChunkIndex] = ChunkHash; - if (Keep) - { - KeepChunkIndexes.push_back(ChunkIndex); - } - }); + { + ZEN_TRACE_CPU("CasContainer::CollectGarbage::Filter"); + GcCtx.FilterCids(TotalChunkHashes, [&](const IoHash& ChunkHash, bool Keep) { + auto KeyIt = LocationMap.find(ChunkHash); + const BlockStoreDiskLocation& DiskLocation = KeyIt->second; + BlockStoreLocation Location = DiskLocation.Get(m_PayloadAlignment); + size_t ChunkIndex = ChunkLocations.size(); + + ChunkLocations.push_back(Location); + ChunkIndexToChunkHash[ChunkIndex] = ChunkHash; + if (Keep) + { + KeepChunkIndexes.push_back(ChunkIndex); + } + }); + } const bool PerformDelete = GcCtx.IsDeletionMode() && GcCtx.CollectSmallObjects(); if (!PerformDelete) |