From: Yingxin Cheng Date: Mon, 25 Jul 2022 08:20:04 +0000 (+0800) Subject: crimson/os/seastore/cache: write cleaner dirty tail if the oldest dirty extent is... X-Git-Tag: v18.0.0~426^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=725cda101f39949f5c7b2829459f1b6789c28daa;p=ceph.git crimson/os/seastore/cache: write cleaner dirty tail if the oldest dirty extent is still pending Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index b91a7272d9ae..eb37bad95826 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -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; diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 99dc301df99d..6c691801af24 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -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 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; } }