]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/filestore: estimate omap_allocated 28851/head
authorSage Weil <sage@redhat.com>
Mon, 9 Apr 2018 19:58:03 +0000 (14:58 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 2 Jul 2019 04:33:23 +0000 (00:33 -0400)
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 <sage@redhat.com>
(cherry picked from commit 186edca81ef09058b9c121967ab1850fbb5812b6)

Conflicts:
src/os/filestore/FileStore.cc

No VDO in luminous

src/os/filestore/FileStore.cc

index 1cdea367702cf86ad27eb168b068c09f98d4ee58..ec75b9773931b92f45fc5e5d541e74b48e0aa62a 100644 (file)
@@ -721,7 +721,22 @@ int FileStore::statfs(struct store_statfs_t *buf0)
     return r;
   }
   buf0->total = buf.f_blocks * buf.f_bsize;
-  buf0->available = buf.f_bavail * buf.f_bsize;
+
+  uint64_t bfree = buf.f_bavail * buf.f_bsize;
+
+  buf0->available = bfree;
+  buf0->allocated = bfree;
+  buf0->data_stored = bfree;
+
+  // assume all of leveldb/rocksdb is omap.
+  {
+    map<string,uint64_t> kv_usage;
+    buf0->omap_allocated += object_map->get_db()->get_estimated_size(kv_usage);
+  }
+
+  // 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();
@@ -730,6 +745,7 @@ int FileStore::statfs(struct store_statfs_t *buf0)
     else
       buf0->available = 0;
   }
+
   return 0;
 }