diff options
| author | Dan Engelbrecht <[email protected]> | 2025-10-24 22:51:50 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-24 22:51:50 +0200 |
| commit | d9d7bc03dbb5b1331e4eeb24c38016292c0beebf (patch) | |
| tree | 8b9b72556855b7e219a0495b7688502dcc784b67 | |
| parent | 5.7.7-pre5 (diff) | |
| download | zen-d9d7bc03dbb5b1331e4eeb24c38016292c0beebf.tar.xz zen-d9d7bc03dbb5b1331e4eeb24c38016292c0beebf.zip | |
optimize blockstore filesize (#612)
* since we only ever append to a block store file we don't need to actually flush the position
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenstore/blockstore.cpp | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bf6b52c5d..b38929888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - `--builds-override-host` option can be used instead of or in addtition to `--builds` to specify host to override cloud storage host discovery - `--zen-cache-host` specifies a Zenserver cache host that overrides any host discovery - Improvement: If gc disk usage log file is corrupt, remove and restart the log +- Improvement: Optimized file size check if currently written CAS block file - Bugfix: Add quotes around messages when using `--log-progress` with `zen builds` commands - Bugfix: Fix ASSERT after running `zen workspace info` on a non-existing workspace. UE-349934 - Bugfix: Fixed issue where GC could start after shutdown of GC had been requested causing a race diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 0fee18420..337a5f8e0 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -163,7 +163,17 @@ BlockStoreFile::Write(const void* Data, uint64_t Size, uint64_t FileOffset) ZEN_TRACE_CPU("BlockStoreFile::Write"); ZEN_ASSERT(Size + FileOffset <= m_IoBuffer.GetSize()); m_File.Write(Data, Size, FileOffset); - m_CachedFileSize.store(0); + + uint64_t NewSize = FileOffset + Size; + uint64_t CurrentSize = m_CachedFileSize.load(); + while (NewSize > CurrentSize) + { + if (m_CachedFileSize.compare_exchange_strong(CurrentSize, NewSize)) + { + break; + } + } + ZEN_ASSERT(m_CachedFileSize.load() >= NewSize); } void |