]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/segment_cleaner: add metrics about journal sizes
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 13 May 2022 09:13:17 +0000 (17:13 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 17 May 2022 08:37:44 +0000 (16:37 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/segment_cleaner.cc
src/crimson/os/seastore/segment_cleaner.h

index ead4f7ec72c9fee3047ccba67a9f642e1f89b408..4463de68dca9078d31a3692677e043294902d92e 100644 (file)
@@ -501,6 +501,13 @@ void SegmentCleaner::register_metrics()
                     [this] { return get_unavailable_unused_bytes(); },
                     sm::description("the size of the space is unavailable and not alive")),
 
+    sm::make_counter("dirty_journal_bytes",
+                    [this] { return get_dirty_journal_size(); },
+                    sm::description("the size of the journal for dirty extents")),
+    sm::make_counter("alloc_journal_bytes",
+                    [this] { return get_alloc_journal_size(); },
+                    sm::description("the size of the journal for alloc info")),
+
     sm::make_counter("projected_count", stats.projected_count,
                    sm::description("the number of projected usage reservations")),
     sm::make_counter("projected_used_bytes_sum", stats.projected_used_bytes_sum,
index e828bb586e442327790d223064d69d781b67ef70..7843d68727ea087659901435ad73e755b5cb8f4e 100644 (file)
@@ -1183,6 +1183,35 @@ private:
       (double)segments.get_total_bytes();
   }
 
+  /*
+   * Journal sizes
+   */
+  std::size_t get_dirty_journal_size() const {
+    auto journal_head = segments.get_journal_head();
+    if (journal_head == JOURNAL_SEQ_NULL ||
+        dirty_extents_replay_from == JOURNAL_SEQ_NULL) {
+      return 0;
+    }
+    return (journal_head.segment_seq - dirty_extents_replay_from.segment_seq) *
+           segments.get_segment_size() +
+           journal_head.offset.as_seg_paddr().get_segment_off() -
+           segments.get_segment_size() -
+           dirty_extents_replay_from.offset.as_seg_paddr().get_segment_off();
+  }
+
+  std::size_t get_alloc_journal_size() const {
+    auto journal_head = segments.get_journal_head();
+    if (journal_head == JOURNAL_SEQ_NULL ||
+        alloc_info_replay_from == JOURNAL_SEQ_NULL) {
+      return 0;
+    }
+    return (journal_head.segment_seq - alloc_info_replay_from.segment_seq) *
+           segments.get_segment_size() +
+           journal_head.offset.as_seg_paddr().get_segment_off() -
+           segments.get_segment_size() -
+           alloc_info_replay_from.offset.as_seg_paddr().get_segment_off();
+  }
+
   /**
    * should_block_on_gc
    *