From 186edca81ef09058b9c121967ab1850fbb5812b6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Apr 2018 14:58:03 -0500 Subject: [PATCH] os/filestore: estimate omap_allocated Assume all of leveldb/rocksdb is omap. This is an overestimate, but better than nothing. We don't populate the metadata overhead (no easy way to calculate this that comes to mind). And we don't populate the compression-related fields. It's possible we could make something up here in the VDO case... Signed-off-by: Sage Weil --- src/os/filestore/FileStore.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 133ab5e7e1aad..9485b1740adbf 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -745,15 +745,29 @@ int FileStore::statfs(struct store_statfs_t *buf0) } uint64_t bfree = buf.f_bavail * buf.f_bsize; + + // assume all of leveldb/rocksdb is omap. + { + map kv_usage; + buf0->omap_allocated += object_map->get_db()->get_estimated_size(kv_usage); + } + uint64_t thin_total, thin_avail; if (get_vdo_utilization(vdo_fd, &thin_total, &thin_avail)) { buf0->total = thin_total; bfree = std::min(bfree, thin_avail); + buf0->allocated = thin_total - thin_avail; + buf0->data_stored = bfree; } else { buf0->total = buf.f_blocks * buf.f_bsize; + buf0->allocated = bfree; + buf0->data_stored = bfree; } buf0->available = bfree; + // FIXME: we don't know how to populate buf->internal_metadata; XFS doesn't + // tell us what its internal overhead is. + // Adjust for writes pending in the journal if (journal) { uint64_t estimate = journal->get_journal_size_estimate(); @@ -762,6 +776,7 @@ int FileStore::statfs(struct store_statfs_t *buf0) else buf0->available = 0; } + return 0; } -- 2.39.5