From 52cfc505fb36f6cc77e29b246db8e0e833116a23 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Oct 2017 22:22:16 -0500 Subject: [PATCH] os/bluestore/BlueFS: drop get_fs_usage(); add get_used() Signed-off-by: Sage Weil --- src/os/bluestore/BlueFS.cc | 12 +++++++----- src/os/bluestore/BlueFS.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 944e3de4b18d4..c58cda4cbd799 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -251,14 +251,16 @@ void BlueFS::handle_discard(unsigned id, interval_set& to_release) alloc[id]->release(to_release); } -uint64_t BlueFS::get_fs_usage() +uint64_t BlueFS::get_used() { std::lock_guard 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) diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 4abacb672b830..aedffa10c3f27 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -346,7 +346,7 @@ public: void get_devices(set *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> *usage); // [ ...] -- 2.39.5