]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/cache: write cleaner dirty tail if the oldest dirty extent is...
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 25 Jul 2022 08:20:04 +0000 (16:20 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 25 Jul 2022 08:32:40 +0000 (16:32 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cache.h

index b91a7272d9aedc51ddc1c3f357b8cbfd22bf1324..eb37bad958263b8e1cb2d19da1798a450f6f165b 100644 (file)
@@ -1249,9 +1249,19 @@ record_t Cache::prepare_record(
 
   if (is_cleaner_transaction(trans_src)) {
     assert(cleaner != nullptr);
+    journal_seq_t dirty_tail;
+    auto maybe_dirty_tail = get_oldest_dirty_from();
+    if (!maybe_dirty_tail.has_value()) {
+      dirty_tail = JOURNAL_SEQ_NULL;
+    } else if (*maybe_dirty_tail == JOURNAL_SEQ_NULL) {
+      dirty_tail = cleaner->get_dirty_tail();
+      ceph_assert(dirty_tail != JOURNAL_SEQ_NULL);
+    } else {
+      dirty_tail = *maybe_dirty_tail;
+    }
     auto tails = journal_tail_delta_t{
       get_oldest_backref_dirty_from().value_or(JOURNAL_SEQ_NULL),
-      get_oldest_dirty_from().value_or(JOURNAL_SEQ_NULL)
+      dirty_tail
     };
     SUBDEBUGT(seastore_t, "update tails as delta {}", t, tails);
     bufferlist bl;
index 99dc301df99d0fd63644a8de7714215d02060099..6c691801af24a1ab02d118cb8424bcb09e7e398e 100644 (file)
@@ -905,21 +905,21 @@ public:
     }
   }
 
-  /// returns std::nullopt if no dirty extents or get_dirty_from() for oldest
+  /// returns std::nullopt if no dirty extents
+  /// returns JOURNAL_SEQ_NULL if the oldest dirty extent is still pending
   std::optional<journal_seq_t> get_oldest_dirty_from() const {
     LOG_PREFIX(Cache::get_oldest_dirty_from);
     if (dirty.empty()) {
-      SUBDEBUG(seastore_cache, "oldest: null");
+      SUBDEBUG(seastore_cache, "dirty_oldest: null");
       return std::nullopt;
     } else {
       auto oldest = dirty.begin()->get_dirty_from();
       if (oldest == JOURNAL_SEQ_NULL) {
-       SUBDEBUG(seastore_cache, "oldest: null");
-       return std::nullopt;
+       SUBINFO(seastore_cache, "dirty_oldest: pending");
       } else {
-       SUBDEBUG(seastore_cache, "oldest: {}", oldest);
-       return oldest;
+       SUBDEBUG(seastore_cache, "dirty_oldest: {}", oldest);
       }
+      return oldest;
     }
   }