aboutsummaryrefslogtreecommitdiff
path: root/zenstore/filecas.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-12-10 15:29:18 +0100
committerPer Larsson <[email protected]>2021-12-10 15:29:18 +0100
commit370d0134a7f755b1e39fbba5c9482ecc9ff3a0fe (patch)
tree7329dc070434ccc265be6a7651274366d8c9fc06 /zenstore/filecas.cpp
parentSet GC default enabled and interval set to zero (off). (diff)
downloadzen-370d0134a7f755b1e39fbba5c9482ecc9ff3a0fe.tar.xz
zen-370d0134a7f755b1e39fbba5c9482ecc9ff3a0fe.zip
Added size to GcStorage.
Diffstat (limited to 'zenstore/filecas.cpp')
-rw-r--r--zenstore/filecas.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index 62600eae6..bfad34c86 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -248,8 +248,8 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash)
if (Success)
{
- m_TotalSize.fetch_add(static_cast<int64_t>(Chunk.Size()));
- m_CasLog.Append({.Key = ChunkHash, .Size = static_cast<int64_t>(Chunk.Size())});
+ m_TotalSize.fetch_add(Chunk.Size(), std::memory_order::relaxed);
+ m_CasLog.Append({.Key = ChunkHash, .Size = Chunk.Size()});
return CasStore::InsertResult{.New = true};
}
@@ -354,8 +354,8 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
// *after* the lock is released due to the initialization order
PayloadFile.Close();
- m_TotalSize.fetch_add(static_cast<int64_t>(ChunkSize));
- m_CasLog.Append({.Key = ChunkHash, .Size = static_cast<int64_t>(ChunkSize)});
+ m_TotalSize.fetch_add(ChunkSize, std::memory_order::relaxed);
+ m_CasLog.Append({.Key = ChunkHash, .Size = ChunkSize});
return {.New = true};
}
@@ -409,7 +409,7 @@ FileCasStrategy::DeleteChunk(const IoHash& ChunkHash, std::error_code& Ec)
if (!Ec)
{
m_TotalSize.fetch_sub(FileSize);
- m_CasLog.Append({.Key = ChunkHash, .Flags = FileCasIndexEntry::kTombStone, .Size = static_cast<int64_t>(FileSize)});
+ m_CasLog.Append({.Key = ChunkHash, .Flags = FileCasIndexEntry::kTombStone, .Size = FileSize});
}
}