Use a separate used_blocks counter for free space stats to hide possibly delayed on-flush deallocation

This commit is contained in:
Vitaliy Filippov
2023-12-31 01:23:17 +03:00
parent d5a6fa6dd7
commit 8b8c1179a7
3 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -277,6 +277,7 @@ class blockstore_impl_t
int unsynced_big_write_count = 0, unstable_unsynced = 0;
int unsynced_queued_ops = 0;
allocator *data_alloc = NULL;
uint64_t used_blocks = 0;
uint8_t *zero_object;
void *metadata_buffer = NULL;
@@ -430,7 +431,7 @@ public:
inline uint32_t get_block_size() { return dsk.data_block_size; }
inline uint64_t get_block_count() { return dsk.block_count; }
inline uint64_t get_free_block_count() { return data_alloc->get_free_count(); }
inline uint64_t get_free_block_count() { return dsk.block_count - used_blocks; }
inline uint32_t get_bitmap_granularity() { return dsk.disk_alignment; }
inline uint64_t get_journal_size() { return dsk.journal_len; }
};