aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/blockstore.cpp22
-rw-r--r--zenstore/compactcas.cpp20
-rw-r--r--zenstore/filecas.cpp4
-rw-r--r--zenstore/gc.cpp14
4 files changed, 23 insertions, 37 deletions
diff --git a/zenstore/blockstore.cpp b/zenstore/blockstore.cpp
index 178687b5f..e502113fc 100644
--- a/zenstore/blockstore.cpp
+++ b/zenstore/blockstore.cpp
@@ -292,17 +292,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
uint64_t DeletedCount = 0;
Stopwatch TotalTimer;
- const auto _ = MakeGuard([this,
- &TotalTimer,
- &WriteBlockTimeUs,
- &WriteBlockLongestTimeUs,
- &ReadBlockTimeUs,
- &ReadBlockLongestTimeUs,
- &TotalChunkCount,
- &DeletedCount,
- &MovedCount,
- &DeletedSize,
- OldTotalSize] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO(
"reclaim space for '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted #{} and moved "
"#{} "
@@ -414,7 +404,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
{
RwLock::SharedLockScope _i(m_InsertLock);
Stopwatch Timer;
- const auto __ = MakeGuard([&Timer, &WriteBlockTimeUs, &WriteBlockLongestTimeUs] {
+ const auto __ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
WriteBlockTimeUs += ElapsedUs;
WriteBlockLongestTimeUs = std::max(ElapsedUs, WriteBlockLongestTimeUs);
@@ -436,7 +426,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
{
RwLock::ExclusiveLockScope _i(m_InsertLock);
Stopwatch Timer;
- const auto __ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] {
+ const auto __ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
ReadBlockTimeUs += ElapsedUs;
ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs);
@@ -476,7 +466,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
MovedChunks.clear();
RwLock::ExclusiveLockScope __(m_InsertLock);
Stopwatch Timer;
- const auto ___ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] {
+ const auto ___ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
ReadBlockTimeUs += ElapsedUs;
ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs);
@@ -515,7 +505,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
NiceBytes(Space.Free + ReclaimedSpace));
RwLock::ExclusiveLockScope _l(m_InsertLock);
Stopwatch Timer;
- const auto __ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] {
+ const auto __ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
ReadBlockTimeUs += ElapsedUs;
ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs);
@@ -559,7 +549,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
{
RwLock::ExclusiveLockScope __(m_InsertLock);
Stopwatch Timer;
- const auto ___ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] {
+ const auto ___ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
ReadBlockTimeUs += ElapsedUs;
ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs);
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index c6115024b..e0f84e044 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -344,7 +344,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx)
m_BlockStore.IterateChunks(
ChunkLocations,
- [&ChunkIndexToChunkHash, &BadKeys](size_t ChunkIndex, const void* Data, uint64_t Size) {
+ [&](size_t ChunkIndex, const void* Data, uint64_t Size) {
const IoHash ComputedHash = IoHash::HashBuffer(Data, Size);
const IoHash& ExpectedHash = ChunkIndexToChunkHash[ChunkIndex];
if (ComputedHash != ExpectedHash)
@@ -353,7 +353,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx)
BadKeys.push_back(ExpectedHash);
}
},
- [&ChunkIndexToChunkHash, &BadKeys](size_t ChunkIndex, BasicFile& BlockFile, uint64_t Offset, uint64_t Size) {
+ [&](size_t ChunkIndex, BasicFile& BlockFile, uint64_t Offset, uint64_t Size) {
IoHashStream Hasher;
BlockFile.StreamByteRange(Offset, Size, [&](const void* Data, uint64_t Size) { Hasher.Append(Data, Size); });
IoHash ComputedHash = Hasher.GetHash();
@@ -493,9 +493,7 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx)
KeepChunkIndexes,
m_PayloadAlignment,
false,
- [this, &DeletedChunks, &ChunkIndexToChunkHash, &LocationMap, &ReadBlockTimeUs, &ReadBlockLongestTimeUs](
- const BlockStore::MovedChunksArray& MovedChunks,
- const BlockStore::ChunkIndexArray& RemovedChunks) {
+ [&](const BlockStore::MovedChunksArray& MovedChunks, const BlockStore::ChunkIndexArray& RemovedChunks) {
std::vector<CasDiskIndexEntry> LogEntries;
LogEntries.reserve(MovedChunks.size() + RemovedChunks.size());
for (const auto& Entry : MovedChunks)
@@ -518,7 +516,7 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx)
{
RwLock::ExclusiveLockScope __(m_LocationMapLock);
Stopwatch Timer;
- const auto ____ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] {
+ const auto ____ = MakeGuard([&] {
uint64_t ElapsedUs = Timer.GetElapsedTimeUs();
ReadBlockTimeUs += ElapsedUs;
ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs);
@@ -547,7 +545,7 @@ CasContainerStrategy::MakeIndexSnapshot()
ZEN_INFO("write store snapshot for '{}'", m_Config.RootDirectory / m_ContainerBaseName);
uint64_t EntryCount = 0;
Stopwatch Timer;
- const auto _ = MakeGuard([this, &EntryCount, &Timer] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("wrote store snapshot for '{}' containing #{} entries in {}",
m_Config.RootDirectory / m_ContainerBaseName,
EntryCount,
@@ -632,7 +630,7 @@ CasContainerStrategy::ReadIndexFile()
if (std::filesystem::is_regular_file(IndexPath))
{
Stopwatch Timer;
- const auto _ = MakeGuard([this, &Entries, &Timer] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("read store '{}' index containing #{} entries in {}",
m_Config.RootDirectory / m_ContainerBaseName,
Entries.size(),
@@ -685,7 +683,7 @@ CasContainerStrategy::ReadLog(uint64_t SkipEntryCount)
if (std::filesystem::is_regular_file(LogPath))
{
Stopwatch Timer;
- const auto _ = MakeGuard([this, &Entries, &Timer] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("read store '{}' log containing #{} entries in {}",
m_Config.RootDirectory / m_ContainerBaseName,
Entries.size(),
@@ -745,7 +743,7 @@ CasContainerStrategy::MigrateLegacyData(bool CleanSource)
uint32_t MigratedBlockCount = 0;
Stopwatch MigrationTimer;
uint64_t TotalSize = 0;
- const auto _ = MakeGuard([this, &MigrationTimer, &MigratedChunkCount, &MigratedBlockCount, &TotalSize] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("migrated store '{}' to #{} chunks in #{} blocks in {} ({})",
m_Config.RootDirectory / m_ContainerBaseName,
MigratedChunkCount,
@@ -768,7 +766,7 @@ CasContainerStrategy::MigrateLegacyData(bool CleanSource)
LegacyCasLog.Open(LegacyLogPath, CleanSource ? CasLogFile::Mode::kWrite : CasLogFile::Mode::kRead);
{
Stopwatch Timer;
- const auto __ = MakeGuard([this, &LegacyDiskIndex, &Timer] {
+ const auto __ = MakeGuard([&] {
ZEN_INFO("read store '{}' legacy log containing #{} entries in {}",
m_Config.RootDirectory / m_ContainerBaseName,
LegacyDiskIndex.size(),
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index b53cfaa54..d074a906f 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -92,7 +92,7 @@ FileCasStrategy::Initialize(bool IsNewStore)
m_CasLog.Open(m_Config.RootDirectory / "cas.ulog", IsNewStore ? CasLogFile::Mode::kTruncate : CasLogFile::Mode::kWrite);
Stopwatch Timer;
- const auto _ = MakeGuard([this, &Timer] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("read log {} containing {}", m_Config.RootDirectory / "cas.ulog", NiceBytes(m_TotalSize.load(std::memory_order::relaxed)));
});
@@ -692,7 +692,7 @@ FileCasStrategy::CollectGarbage(GcContext& GcCtx)
uint64_t OldTotalSize = m_TotalSize.load(std::memory_order::relaxed);
Stopwatch TotalTimer;
- const auto _ = MakeGuard([this, &TotalTimer, &DeletedCount, &ChunkCount, OldTotalSize] {
+ const auto _ = MakeGuard([&] {
ZEN_INFO("garbage collect for '{}' DONE after {}, deleted {} out of {} files, removed {} out of {}",
m_Config.RootDirectory,
NiceTimeSpanMs(TotalTimer.GetElapsedTimeMs()),
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 21522e46a..4b50668d9 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -76,7 +76,7 @@ namespace {
return MakeErrorCodeFromLastError();
}
bool Keep = true;
- auto _ = MakeGuard([FileHandle, &Keep, Path]() {
+ auto _ = MakeGuard([&]() {
::CloseHandle(FileHandle);
if (!Keep)
{
@@ -105,7 +105,7 @@ namespace {
}
bool Keep = true;
- auto _ = MakeGuard([Fd, &Keep, Path]() {
+ auto _ = MakeGuard([&]() {
close(Fd);
if (!Keep)
{
@@ -392,7 +392,7 @@ CasGc::CollectGarbage(GcContext& GcCtx)
// First gather reference set
{
Stopwatch Timer;
- const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("gathered references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ const auto Guard = MakeGuard([&] { ZEN_INFO("gathered references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
for (GcContributor* Contributor : m_GcContribs)
{
Contributor->GatherReferences(GcCtx);
@@ -433,7 +433,7 @@ CasGc::CollectGarbage(GcContext& GcCtx)
{
Stopwatch Timer;
- const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("collected garbage in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ const auto Guard = MakeGuard([&] { ZEN_INFO("collected garbage in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
for (GcStorage* Storage : m_GcStorage)
{
Storage->CollectGarbage(GcCtx);
@@ -445,8 +445,7 @@ CasGc::CollectGarbage(GcContext& GcCtx)
if (CidStore* CidStore = m_CidStore)
{
Stopwatch Timer;
- const auto Guard =
- MakeGuard([this, &Timer] { ZEN_INFO("clean up deleted content ids in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ const auto Guard = MakeGuard([&] { ZEN_INFO("clean up deleted content ids in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
CidStore->RemoveCids(GcCtx.DeletedCas());
}
}
@@ -672,8 +671,7 @@ GcScheduler::SchedulerThread()
NiceTimeSpanMs(uint64_t(std::chrono::duration_cast<std::chrono::milliseconds>(GcCtx.MaxCacheDuration()).count())));
{
Stopwatch Timer;
- const auto __ =
- MakeGuard([this, &Timer] { ZEN_INFO("garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ const auto __ = MakeGuard([&] { ZEN_INFO("garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
m_CasGc.CollectGarbage(GcCtx);