]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/segment_cleaner: distinguish journal/ool when count open/close...
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 9 May 2022 07:50:40 +0000 (15:50 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 13 May 2022 07:51:20 +0000 (15:51 +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 91d90fd0547406f0588d6f377a864e3179395090..b5d3f2b21d5797a690e2272e6b7e551788f09644 100644 (file)
@@ -88,9 +88,12 @@ void segments_info_t::reset()
   num_empty = 0;
   num_closed = 0;
 
-  count_open = 0;
-  count_release = 0;
-  count_close = 0;
+  count_open_journal = 0;
+  count_open_ool = 0;
+  count_release_journal = 0;
+  count_release_ool = 0;
+  count_close_journal = 0;
+  count_close_ool = 0;
 
   total_bytes = 0;
   avail_bytes_in_open = 0;
@@ -147,7 +150,7 @@ void segments_info_t::init_closed(
   } else {
     ++num_type_ool;
   }
-  // do not increment count_close;
+  // do not increment count_close_*;
 }
 
 void segments_info_t::mark_open(
@@ -174,12 +177,13 @@ void segments_info_t::mark_open(
 
     ++num_in_journal_open;
     ++num_type_journal;
+    ++count_open_journal;
   } else {
     ++num_type_ool;
+    ++count_open_ool;
   }
   ceph_assert(segment_info.written_to == 0);
   avail_bytes_in_open += get_segment_size();
-  ++count_open;
 }
 
 void segments_info_t::mark_empty(
@@ -200,11 +204,12 @@ void segments_info_t::mark_empty(
   if (type == segment_type_t::JOURNAL) {
     ceph_assert(num_type_journal > 0);
     --num_type_journal;
+    ++count_release_journal;
   } else {
     ceph_assert(num_type_ool > 0);
     --num_type_ool;
+    ++count_release_ool;
   }
-  ++count_release;
 }
 
 void segments_info_t::mark_closed(
@@ -223,12 +228,14 @@ void segments_info_t::mark_closed(
   if (segment_info.type == segment_type_t::JOURNAL) {
     ceph_assert(num_in_journal_open > 0);
     --num_in_journal_open;
+    ++count_close_journal;
+  } else {
+    ++count_close_ool;
   }
   ceph_assert(get_segment_size() >= segment_info.written_to);
   auto seg_avail_bytes = get_segment_size() - segment_info.written_to;
   ceph_assert(avail_bytes_in_open >= seg_avail_bytes);
   avail_bytes_in_open -= seg_avail_bytes;
-  ++count_close;
 }
 
 void segments_info_t::update_written_to(
@@ -457,15 +464,24 @@ void SegmentCleaner::register_metrics()
                     [this] { return segments.get_num_closed(); },
                     sm::description("the number of closed segments")),
 
-    sm::make_counter("segments_count_open",
-                    [this] { return segments.get_count_open(); },
-                    sm::description("the count of open segment operations")),
-    sm::make_counter("segments_count_release",
-                    [this] { return segments.get_count_release(); },
-                    sm::description("the count of release segment operations")),
-    sm::make_counter("segments_count_close",
-                    [this] { return segments.get_count_close(); },
-                    sm::description("the count of close segment operations")),
+    sm::make_counter("segments_count_open_journal",
+                    [this] { return segments.get_count_open_journal(); },
+                    sm::description("the count of open journal segment operations")),
+    sm::make_counter("segments_count_open_ool",
+                    [this] { return segments.get_count_open_ool(); },
+                    sm::description("the count of open ool segment operations")),
+    sm::make_counter("segments_count_release_journal",
+                    [this] { return segments.get_count_release_journal(); },
+                    sm::description("the count of release journal segment operations")),
+    sm::make_counter("segments_count_release_ool",
+                    [this] { return segments.get_count_release_ool(); },
+                    sm::description("the count of release ool segment operations")),
+    sm::make_counter("segments_count_close_journal",
+                    [this] { return segments.get_count_close_journal(); },
+                    sm::description("the count of close journal segment operations")),
+    sm::make_counter("segments_count_close_ool",
+                    [this] { return segments.get_count_close_ool(); },
+                    sm::description("the count of close ool segment operations")),
 
     sm::make_counter("total_bytes",
                     [this] { return segments.get_total_bytes(); },
index a95605ecf99071892972658884573951590fb29e..eaf95353bb72c52a7f747ef313443c327d28b135 100644 (file)
@@ -132,14 +132,23 @@ public:
   std::size_t get_num_closed() const {
     return num_closed;
   }
-  std::size_t get_count_open() const {
-    return count_open;
+  std::size_t get_count_open_journal() const {
+    return count_open_journal;
   }
-  std::size_t get_count_release() const {
-    return count_release;
+  std::size_t get_count_open_ool() const {
+    return count_open_ool;
   }
-  std::size_t get_count_close() const {
-    return count_close;
+  std::size_t get_count_release_journal() const {
+    return count_release_journal;
+  }
+  std::size_t get_count_release_ool() const {
+    return count_release_ool;
+  }
+  std::size_t get_count_close_journal() const {
+    return count_close_journal;
+  }
+  std::size_t get_count_close_ool() const {
+    return count_close_ool;
   }
 
   std::size_t get_total_bytes() const {
@@ -212,9 +221,12 @@ private:
   std::size_t num_empty;
   std::size_t num_closed;
 
-  std::size_t count_open;
-  std::size_t count_release;
-  std::size_t count_close;
+  std::size_t count_open_journal;
+  std::size_t count_open_ool;
+  std::size_t count_release_journal;
+  std::size_t count_release_ool;
+  std::size_t count_close_journal;
+  std::size_t count_close_ool;
 
   std::size_t total_bytes;
   std::size_t avail_bytes_in_open;