aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/blockstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenstore/blockstore.cpp')
-rw-r--r--src/zenstore/blockstore.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index c50f2bb13..b8fa03305 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -121,6 +121,12 @@ BlockStoreFile::FileSize() const
{
return 0;
}
+ uint64_t Expected = 0;
+ if (!m_CachedFileSize.compare_exchange_strong(Expected, Size))
+ {
+ // Force a new check next time file size is fetched
+ m_CachedFileSize.store(0);
+ }
return Size;
}
return m_CachedFileSize;
@@ -153,13 +159,8 @@ void
BlockStoreFile::Write(const void* Data, uint64_t Size, uint64_t FileOffset)
{
ZEN_TRACE_CPU("BlockStoreFile::Write");
-#if ZEN_BUILD_DEBUG
- if (uint64_t CachedFileSize = m_CachedFileSize.load(); CachedFileSize > 0)
- {
- ZEN_ASSERT(FileOffset + Size <= CachedFileSize);
- }
-#endif // ZEN_BUILD_DEBUG
m_File.Write(Data, Size, FileOffset);
+ m_CachedFileSize.store(0);
}
void