]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: wire up stat
authorSamuel Just <sjust@redhat.com>
Fri, 30 Apr 2021 21:10:57 +0000 (14:10 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 7 May 2021 07:36:34 +0000 (00:36 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/segment_cleaner.h
src/crimson/os/seastore/transaction_manager.h

index 7077df0c65988d61b8a2fe3c926038aae0032b88..1c362dac29236685f0894c25c5204e053c0d3aa6 100644 (file)
@@ -88,8 +88,9 @@ seastar::future<store_statfs_t> SeaStore::stat() const
 {
   LOG_PREFIX(SeaStore::stat);
   DEBUG("");
-  store_statfs_t st;
-  return seastar::make_ready_future<store_statfs_t>(st);
+  return seastar::make_ready_future<store_statfs_t>(
+    transaction_manager->store_stat()
+  );
 }
 
 seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>>
index bce976886d94cc25853f8f8ad2605e0838b303b5..ee291f4db23ad9b0cd48d4cef23ea2be483c77a1 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "common/ceph_time.h"
 
+#include "osd/osd_types.h"
+
 #include "crimson/common/log.h"
 #include "crimson/os/seastore/cached_extent.h"
 #include "crimson/os/seastore/journal.h"
@@ -503,6 +505,18 @@ public:
     start();
   }
 
+  store_statfs_t stat() const {
+    store_statfs_t st;
+    st.total = get_total_bytes();
+    st.available = get_total_bytes() - get_used_bytes();
+    st.allocated = get_used_bytes();
+    st.data_stored = get_used_bytes();
+
+    // TODO add per extent type counters for omap_allocated and
+    // internal metadata
+    return st;
+  }
+
   seastar::future<> stop() {
     return gc_process.stop();
   }
index afbf69fe84c65da73b698781901b844e0db43fa2..07125396d0b024858f09f1b7cd5874ba6f27f768 100644 (file)
@@ -473,6 +473,10 @@ public:
     return segment_manager.get_block_size();
   }
 
+  store_statfs_t store_stat() const {
+    return segment_cleaner->stat();
+  }
+
   ~TransactionManager();
 
 private: