]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: drop get_fs_usage(); add get_used()
authorSage Weil <sage@redhat.com>
Tue, 3 Oct 2017 03:22:16 +0000 (22:22 -0500)
committerSage Weil <sage@redhat.com>
Wed, 15 Aug 2018 22:18:43 +0000 (17:18 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 944e3de4b18d4967c9ad3bd5fbfb92c8a7b7c8ce..c58cda4cbd799307cf938b58ef803455abf6640b 100644 (file)
@@ -251,14 +251,16 @@ void BlueFS::handle_discard(unsigned id, interval_set<uint64_t>& to_release)
   alloc[id]->release(to_release);
 }
 
-uint64_t BlueFS::get_fs_usage()
+uint64_t BlueFS::get_used()
 {
   std::lock_guard<std::mutex> l(lock);
-  uint64_t total_bytes = 0;
-  for (auto& p : file_map) {
-    total_bytes += p.second->fnode.get_allocated();
+  uint64_t used = 0;
+  for (unsigned id = 0; id < MAX_BDEV; ++id) {
+    if (alloc[id]) {
+      used += block_all[id].size() - alloc[id]->get_free();
+    }
   }
-  return total_bytes;
+  return used;
 }
 
 uint64_t BlueFS::get_total(unsigned id)
index 4abacb672b8308a2128f14942f3fe46f9b8ff5be..aedffa10c3f27c09b469a7eb97cb6a809eea73e8 100644 (file)
@@ -346,7 +346,7 @@ public:
   void get_devices(set<string> *ls);
   int fsck();
 
-  uint64_t get_fs_usage();
+  uint64_t get_used();
   uint64_t get_total(unsigned id);
   uint64_t get_free(unsigned id);
   void get_usage(vector<pair<uint64_t,uint64_t>> *usage); // [<free,total> ...]