]> 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)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 2 Jul 2019 04:33:22 +0000 (00:33 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 52cfc505fb36f6cc77e29b246db8e0e833116a23)

Conflicts:
src/os/bluestore/BlueFS.cc

trivial resolution

src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 916138351a7695da0805834677d5cd6727457237..9330e27d39646b7927964bdd5cbec0e32e58d2a7 100644 (file)
@@ -220,14 +220,16 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want,
   return 0;
 }
 
-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 81ea1a1c57471b39c8aa34c20c121aeb5079c2be..6b3c57b1a8d177e6d01d6a75da1560df782a1c34 100644 (file)
@@ -336,7 +336,7 @@ public:
   void collect_metadata(map<string,string> *pm);
   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> ...]