]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: differentiate cleaner trim/reclaim transactions
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 6 Dec 2021 08:33:47 +0000 (16:33 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 8 Dec 2021 05:46:07 +0000 (13:46 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/segment_cleaner.cc
src/crimson/os/seastore/transaction.h

index 22c8af25d739d66a04303a732f9a7d480043ae70..7e56789382fcde4948094d006e2c117c763fa8ce 100644 (file)
@@ -106,7 +106,8 @@ void Cache::register_metrics()
   std::map<src_t, sm::label_instance> labels_by_src {
     {src_t::MUTATE,  src_label("MUTATE")},
     {src_t::READ,    src_label("READ")},
-    {src_t::CLEANER, src_label("CLEANER")},
+    {src_t::CLEANER_TRIM, src_label("CLEANER_TRIM")},
+    {src_t::CLEANER_RECLAIM, src_label("CLEANER_RECLAIM")},
   };
 
   auto ext_label = sm::label("ext");
@@ -514,7 +515,9 @@ void Cache::register_metrics()
         // READ transaction won't contain any tree inserts and erases
         continue;
       }
-      if (src == src_t::CLEANER && tree_label == onode_label) {
+      if ((src == src_t::CLEANER_TRIM ||
+           src == src_t::CLEANER_RECLAIM) &&
+          tree_label == onode_label) {
         // CLEANER transaction won't contain any onode tree operations
         continue;
       }
@@ -730,7 +733,8 @@ void Cache::mark_transaction_conflicted(
     record_header_fullness.ool_stats.filled_bytes += ool_stats.header_raw_bytes;
     record_header_fullness.ool_stats.total_bytes += ool_stats.header_bytes;
 
-    if (t.get_src() == Transaction::src_t::CLEANER) {
+    if (t.get_src() == Transaction::src_t::CLEANER_TRIM ||
+        t.get_src() == Transaction::src_t::CLEANER_RECLAIM) {
       // CLEANER transaction won't contain any onode tree operations
       assert(t.onode_tree_stats.is_clear());
     } else {
@@ -846,7 +850,8 @@ record_t Cache::prepare_record(Transaction &t)
   assert(!t.is_weak());
   assert(t.get_src() != Transaction::src_t::READ);
 
-  if (t.get_src() == Transaction::src_t::CLEANER) {
+  if (t.get_src() == Transaction::src_t::CLEANER_TRIM ||
+      t.get_src() == Transaction::src_t::CLEANER_RECLAIM) {
     // CLEANER transaction won't contain any onode tree operations
     assert(t.onode_tree_stats.is_clear());
   } else {
index dc7664cb3a7d804295359fa1948c7467a9e6637d..af3fdefcf1edc4b9798303c2115a7bd6e9170fd3 100644 (file)
@@ -309,7 +309,7 @@ SegmentCleaner::gc_trim_journal_ret SegmentCleaner::gc_trim_journal()
 {
   return repeat_eagain([this] {
     return ecb->with_transaction_intr(
-        Transaction::src_t::CLEANER, [this](auto& t) {
+        Transaction::src_t::CLEANER_TRIM, [this](auto& t) {
       return rewrite_dirty(t, get_dirty_tail()
       ).si_then([this, &t] {
         return ecb->submit_transaction_direct(t);
@@ -349,7 +349,7 @@ SegmentCleaner::gc_reclaim_space_ret SegmentCleaner::gc_reclaim_space()
           "SegmentCleaner::gc_reclaim_space: processing {} extents",
           extents.size());
         return ecb->with_transaction_intr(
-            Transaction::src_t::CLEANER,
+            Transaction::src_t::CLEANER_RECLAIM,
             [this, &extents](auto& t) {
           return trans_intr::do_for_each(
               extents,
index 4efbeca5f8361ba21ba8af80d6777ea5a6f52a74..11927d34c8573ca4ce4881b23030b561941bfce8 100644 (file)
@@ -204,7 +204,8 @@ public:
   enum class src_t : uint8_t {
     MUTATE = 0,
     READ, // including weak and non-weak read transactions
-    CLEANER,
+    CLEANER_TRIM,
+    CLEANER_RECLAIM,
     MAX
   };
   static constexpr auto SRC_MAX = static_cast<std::size_t>(src_t::MAX);
@@ -410,8 +411,10 @@ inline std::ostream& operator<<(std::ostream& os,
     return os << "MUTATE";
   case Transaction::src_t::READ:
     return os << "READ";
-  case Transaction::src_t::CLEANER:
-    return os << "CLEANER";
+  case Transaction::src_t::CLEANER_TRIM:
+    return os << "CLEANER_TRIM";
+  case Transaction::src_t::CLEANER_RECLAIM:
+    return os << "CLEANER_RECLAIM";
   default:
     ceph_abort("impossible");
   }