]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: include bluefs space in statfs result 10795/head
authorSage Weil <sage@redhat.com>
Sun, 21 Aug 2016 23:33:47 +0000 (18:33 -0500)
committerSage Weil <sage@redhat.com>
Sun, 21 Aug 2016 23:33:47 +0000 (18:33 -0500)
We were counting all (free) space allocated to bluefs as used.  Instead,
query bluefs to find out what is used and what is free.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index eac416d0e8e63778825a4142c68bba9af74d31b2..3064fea80744d58e2f0dc1ff9a5fb8fb952827b5 100644 (file)
@@ -3388,15 +3388,20 @@ void BlueStore::_sync()
 
 int BlueStore::statfs(struct store_statfs_t *buf)
 {
-  uint64_t bluefs_len = 0;
-  for (interval_set<uint64_t>::iterator p = bluefs_extents.begin();
-      p != bluefs_extents.end(); p++)
-    bluefs_len += p.get_len();
-
   buf->reset();
   buf->total = bdev->get_size();
-  assert(alloc->get_free() >= bluefs_len);
-  buf->available = (alloc->get_free() - bluefs_len);
+  buf->available = alloc->get_free();
+
+  if (bluefs) {
+    // part of our shared device is "free" accordingly to BlueFS
+    buf->available += bluefs->get_free(bluefs_shared_bdev);
+
+    // include dedicated db, too, if that isn't the shared device.
+    if (bluefs_shared_bdev != BlueFS::BDEV_DB) {
+      buf->available += bluefs->get_free(BlueFS::BDEV_DB);
+      buf->total += bluefs->get_total(BlueFS::BDEV_DB);
+    }
+  }
 
   bufferlist bl;
   int r = db->get(PREFIX_STAT, "bluestore_statfs", &bl);