]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/segment_cleaner: add metrics about why IO is blocking
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 13 May 2022 08:40:26 +0000 (16:40 +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 56e5ab8920a195bfcf023b664ce10c577c71da34..ead4f7ec72c9fee3047ccba67a9f642e1f89b408 100644 (file)
@@ -510,6 +510,10 @@ void SegmentCleaner::register_metrics()
                    sm::description("the sum of IOs")),
     sm::make_counter("io_blocked_count", stats.io_blocked_count,
                    sm::description("IOs that are blocked by gc")),
+    sm::make_counter("io_blocked_count_trim", stats.io_blocked_count_trim,
+                   sm::description("IOs that are blocked by trimming")),
+    sm::make_counter("io_blocked_count_reclaim", stats.io_blocked_count_reclaim,
+                   sm::description("IOs that are blocked by reclaimming")),
     sm::make_counter("io_blocked_sum", stats.io_blocked_sum,
                     sm::description("the sum of blocking IOs")),
 
index d6e4e6b91bb7d5e7fcf5395056df775b49b81b10..e828bb586e442327790d223064d69d781b67ef70 100644 (file)
@@ -658,6 +658,8 @@ private:
     uint64_t io_blocking_num = 0;
     uint64_t io_count = 0;
     uint64_t io_blocked_count = 0;
+    uint64_t io_blocked_count_trim = 0;
+    uint64_t io_blocked_count_reclaim = 0;
     uint64_t io_blocked_sum = 0;
 
     uint64_t reclaiming_bytes = 0;
@@ -1186,10 +1188,11 @@ private:
    *
    * Encapsulates whether block pending gc.
    */
-  bool should_block_on_gc() const {
-    if (get_dirty_tail_limit() > journal_tail_target) {
-      return true;
-    }
+  bool should_block_on_trim() const {
+    return get_dirty_tail_limit() > journal_tail_target;
+  }
+
+  bool should_block_on_reclaim() const {
     if (get_segments_reclaimable() == 0) {
       return false;
     }
@@ -1202,6 +1205,10 @@ private:
     );
   }
 
+  bool should_block_on_gc() const {
+    return should_block_on_trim() || should_block_on_reclaim();
+  }
+
   void log_gc_state(const char *caller) const {
     auto &logger = crimson::get_logger(ceph_subsys_seastore_cleaner);
     if (logger.is_enabled(seastar::log_level::debug)) {
@@ -1256,13 +1263,20 @@ public:
     // The pipeline configuration prevents another IO from entering
     // prepare until the prior one exits and clears this.
     ceph_assert(!blocked_io_wake);
-    bool is_blocked = false;
     ++stats.io_count;
-    if (should_block_on_gc()) {
+    bool is_blocked = false;
+    if (should_block_on_trim()) {
+      is_blocked = true;
+      ++stats.io_blocked_count_trim;
+    }
+    if (should_block_on_reclaim()) {
+      is_blocked = true;
+      ++stats.io_blocked_count_reclaim;
+    }
+    if (is_blocked) {
       ++stats.io_blocking_num;
       ++stats.io_blocked_count;
       stats.io_blocked_sum += stats.io_blocking_num;
-      is_blocked = true;
     }
     return seastar::do_until(
       [this] {