aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-05-02 17:06:30 +0200
committerDan Engelbrecht <[email protected]>2022-05-02 17:06:30 +0200
commit1e3da36ef01f6b823febf22645a314267353a223 (patch)
tree60f2a2b5f680cc04e6546bf4aaf7e0d94ad1632a
parentclean up any incomplete blocks if ReclaimSpace fails (diff)
downloadzen-1e3da36ef01f6b823febf22645a314267353a223.tar.xz
zen-1e3da36ef01f6b823febf22645a314267353a223.zip
switched back memory_order for m_TotalSize to relaxed
-rw-r--r--zenserver/cache/structuredcachestore.cpp12
-rw-r--r--zenstore/compactcas.cpp4
2 files changed, 8 insertions, 8 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index a9e9b8f78..ae3b401a5 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -567,7 +567,7 @@ ZenCacheMemoryLayer::CacheBucket::Put(const IoHash& HashKey, const ZenCacheValue
m_CacheMap.insert_or_assign(HashKey, BucketValue(Value.Value, GcClock::TickCount()));
}
- m_TotalSize.fetch_add(Value.Value.GetSize(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(Value.Value.GetSize(), std::memory_order::relaxed);
}
//////////////////////////////////////////////////////////////////////////
@@ -1088,7 +1088,7 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const fs::path& BucketDir, const bool Is
for (const auto& Entry : m_Index)
{
const DiskLocation& Location = Entry.second.Location;
- m_TotalSize.fetch_add(Location.Size(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(Location.Size(), std::memory_order::relaxed);
if (Location.IsFlagSet(DiskLocation::kStandaloneFile))
{
continue;
@@ -1554,10 +1554,10 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx)
}
m_SlogFile.Append(DiskIndexEntry{.Key = Key, .Location = RestoreLocation});
m_Index.insert({Key, {Loc, GcClock::TickCount()}});
- m_TotalSize.fetch_add(Entry.Location.Size(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(Entry.Location.Size(), std::memory_order::relaxed);
continue;
}
- m_TotalSize.fetch_sub(Entry.Location.Size(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_sub(Entry.Location.Size(), std::memory_order::relaxed);
DeletedSize += Entry.Location.Size();
DeletedCount++;
}
@@ -1815,7 +1815,7 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
}
m_SlogFile.Append({.Key = HashKey, .Location = Loc});
- m_TotalSize.fetch_add(Loc.Size(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(Loc.Size(), std::memory_order::relaxed);
}
void
@@ -1836,7 +1836,7 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const
DiskLocation Location(BlockStoreLocation, m_PayloadAlignment, EntryFlags);
const DiskIndexEntry DiskIndexEntry{.Key = HashKey, .Location = Location};
m_SlogFile.Append(DiskIndexEntry);
- m_TotalSize.fetch_add(BlockStoreLocation.Size, std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(BlockStoreLocation.Size, std::memory_order::relaxed);
RwLock::ExclusiveLockScope __(m_IndexLock);
if (auto It = m_Index.find(HashKey); It != m_Index.end())
{
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index e0f84e044..22f8ea0c3 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -258,7 +258,7 @@ CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const
RwLock::ExclusiveLockScope _(m_LocationMapLock);
m_LocationMap.emplace(ChunkHash, DiskLocation);
}
- m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order::relaxed);
return CasStore::InsertResult{.New = true};
}
@@ -960,7 +960,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
for (const auto& Entry : m_LocationMap)
{
const BlockStoreDiskLocation& Location = Entry.second;
- m_TotalSize.fetch_add(Location.GetSize(), std::memory_order_seq_cst);
+ m_TotalSize.fetch_add(Location.GetSize(), std::memory_order::relaxed);
KnownLocations.push_back(Location.Get(m_PayloadAlignment));
}