]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BlueFS: interface to get bluefs space usage
authorVarada Kari <varada.kari@sandisk.com>
Fri, 22 Jul 2016 11:24:41 +0000 (16:54 +0530)
committerSage Weil <sage@redhat.com>
Sat, 13 Aug 2016 15:49:12 +0000 (11:49 -0400)
Returns total bytes consumed by BlueFS across devs

Signed-off-by: Varada Kari <varada.kari@sandisk.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 919e07e5fc583e96fde96b3d6714199a92adeb67..189b9cd1af9805f4f13dd99cd55584d5ac35271a 100644 (file)
@@ -186,6 +186,15 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want,
   return 0;
 }
 
+uint64_t BlueFS::get_fs_usage()
+{
+  uint64_t total_bytes = 0;
+  for (auto& p : file_map) {
+    total_bytes += p.second->fnode.get_allocated();
+  }
+  return total_bytes;
+}
+
 uint64_t BlueFS::get_total(unsigned id)
 {
   std::lock_guard<std::mutex> l(lock);
index f3bf5700ac84d2270fe2a266244d3a83d5a5092a..a71a11b5c91d9896dbed2b4309ad66bcf5f07b7f 100644 (file)
@@ -296,6 +296,7 @@ public:
 
   int fsck();
 
+  uint64_t get_fs_usage();
   uint64_t get_total(unsigned id);
   uint64_t get_free(unsigned id);
   void get_usage(vector<pair<uint64_t,uint64_t>> *usage); // [<free,total> ...]