From: Yingxin Cheng Date: Wed, 31 Aug 2022 08:24:11 +0000 (+0800) Subject: crimson/os/seastore: rename transaction type properly X-Git-Tag: v18.0.0~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5c425d5bfafe5904f13db1dc744cc441e3714f2c;p=ceph.git crimson/os/seastore: rename transaction type properly Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/async_cleaner.cc b/src/crimson/os/seastore/async_cleaner.cc index 576b2128bc3..28673bee502 100644 --- a/src/crimson/os/seastore/async_cleaner.cc +++ b/src/crimson/os/seastore/async_cleaner.cc @@ -557,7 +557,7 @@ JournalTrimmerImpl::trim_alloc() assert(background_callback->is_ready()); return repeat_eagain([this, FNAME] { return extent_callback->with_transaction_intr( - Transaction::src_t::CLEANER_TRIM_ALLOC, + Transaction::src_t::TRIM_ALLOC, "trim_alloc", [this, FNAME](auto &t) { @@ -591,7 +591,7 @@ JournalTrimmerImpl::trim_dirty() assert(background_callback->is_ready()); return repeat_eagain([this, FNAME] { return extent_callback->with_transaction_intr( - Transaction::src_t::CLEANER_TRIM_DIRTY, + Transaction::src_t::TRIM_DIRTY, "trim_dirty", [this, FNAME](auto &t) { @@ -1023,7 +1023,7 @@ SegmentCleaner::do_reclaim_space( reclaimed = 0; runs++; return extent_callback->with_transaction_intr( - Transaction::src_t::CLEANER_RECLAIM, + Transaction::src_t::CLEANER, "clean_reclaim_space", [this, &backref_extents, &pin_list, &reclaimed](auto &t) { diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 16c63dd1599..d29d5d8b032 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -133,9 +133,9 @@ void Cache::register_metrics() std::map labels_by_src { {src_t::MUTATE, sm::label_instance("src", "MUTATE")}, {src_t::READ, sm::label_instance("src", "READ")}, - {src_t::CLEANER_TRIM_DIRTY, sm::label_instance("src", "CLEANER_TRIM_DIRTY")}, - {src_t::CLEANER_TRIM_ALLOC, sm::label_instance("src", "CLEANER_TRIM_ALLOC")}, - {src_t::CLEANER_RECLAIM, sm::label_instance("src", "CLEANER_RECLAIM")}, + {src_t::TRIM_DIRTY, sm::label_instance("src", "TRIM_DIRTY")}, + {src_t::TRIM_ALLOC, sm::label_instance("src", "TRIM_ALLOC")}, + {src_t::CLEANER, sm::label_instance("src", "CLEANER")}, }; assert(labels_by_src.size() == (std::size_t)src_t::MAX); @@ -531,7 +531,7 @@ void Cache::register_metrics() // READ transaction won't contain any tree inserts and erases continue; } - if (is_cleaner_transaction(src) && + if (is_background_transaction(src) && (tree_label == onode_label || tree_label == omap_label)) { // CLEANER transaction won't contain any onode/omap tree operations @@ -622,12 +622,12 @@ void Cache::register_metrics() // should be consistent with checks in account_conflict() if ((src1 == Transaction::src_t::READ && src2 == Transaction::src_t::READ) || - (src1 == Transaction::src_t::CLEANER_TRIM_DIRTY && - src2 == Transaction::src_t::CLEANER_TRIM_DIRTY) || - (src1 == Transaction::src_t::CLEANER_RECLAIM && - src2 == Transaction::src_t::CLEANER_RECLAIM) || - (src1 == Transaction::src_t::CLEANER_TRIM_ALLOC && - src2 == Transaction::src_t::CLEANER_TRIM_ALLOC)) { + (src1 == Transaction::src_t::TRIM_DIRTY && + src2 == Transaction::src_t::TRIM_DIRTY) || + (src1 == Transaction::src_t::CLEANER && + src2 == Transaction::src_t::CLEANER) || + (src1 == Transaction::src_t::TRIM_ALLOC && + src2 == Transaction::src_t::TRIM_ALLOC)) { continue; } std::ostringstream oss; @@ -871,7 +871,7 @@ void Cache::mark_transaction_conflicted( auto ool_record_bytes = (ool_stats.md_bytes + ool_stats.get_data_bytes()); efforts.ool_record_bytes += ool_record_bytes; - if (is_cleaner_transaction(t.get_src())) { + if (is_background_transaction(t.get_src())) { // CLEANER transaction won't contain any onode/omap tree operations assert(t.onode_tree_stats.is_clear()); assert(t.omap_tree_stats.is_clear()); @@ -1252,7 +1252,7 @@ record_t Cache::prepare_record( record.push_back(std::move(delta)); } - if (is_cleaner_transaction(trans_src)) { + if (is_background_transaction(trans_src)) { assert(journal_head != JOURNAL_SEQ_NULL); assert(journal_dirty_tail != JOURNAL_SEQ_NULL); journal_seq_t dirty_tail; @@ -1335,8 +1335,8 @@ record_t Cache::prepare_record( record.size.get_raw_mdlength(), record.size.dlength, sea_time_point_printer_t{record.modify_time}); - if (is_cleaner_transaction(trans_src)) { - // CLEANER transaction won't contain any onode tree operations + if (is_background_transaction(trans_src)) { + // background transaction won't contain any onode tree operations assert(t.onode_tree_stats.is_clear()); assert(t.omap_tree_stats.is_clear()); } else { @@ -1379,9 +1379,9 @@ record_t Cache::prepare_record( (record.size.get_raw_mdlength() - record.get_delta_size()); auto &rewrite_version_stats = t.get_rewrite_version_stats(); - if (trans_src == Transaction::src_t::CLEANER_TRIM_DIRTY) { + if (trans_src == Transaction::src_t::TRIM_DIRTY) { stats.committed_dirty_version.increment_stat(rewrite_version_stats); - } else if (trans_src == Transaction::src_t::CLEANER_RECLAIM) { + } else if (trans_src == Transaction::src_t::CLEANER) { stats.committed_reclaim_version.increment_stat(rewrite_version_stats); } else { assert(rewrite_version_stats.is_clear()); diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 54735cd4d8d..c8443227e60 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -1223,12 +1223,12 @@ private: // should be consistent with trans_srcs_invalidated in register_metrics() assert(!(src1 == Transaction::src_t::READ && src2 == Transaction::src_t::READ)); - assert(!(src1 == Transaction::src_t::CLEANER_TRIM_DIRTY && - src2 == Transaction::src_t::CLEANER_TRIM_DIRTY)); - assert(!(src1 == Transaction::src_t::CLEANER_RECLAIM && - src2 == Transaction::src_t::CLEANER_RECLAIM)); - assert(!(src1 == Transaction::src_t::CLEANER_TRIM_ALLOC && - src2 == Transaction::src_t::CLEANER_TRIM_ALLOC)); + assert(!(src1 == Transaction::src_t::TRIM_DIRTY && + src2 == Transaction::src_t::TRIM_DIRTY)); + assert(!(src1 == Transaction::src_t::CLEANER && + src2 == Transaction::src_t::CLEANER)); + assert(!(src1 == Transaction::src_t::TRIM_ALLOC && + src2 == Transaction::src_t::TRIM_ALLOC)); auto src1_value = static_cast(src1); auto src2_value = static_cast(src2); @@ -1256,7 +1256,7 @@ private: CachedExtent &ext, const Transaction::src_t* p_src=nullptr) { - if (p_src && is_cleaner_transaction(*p_src)) + if (p_src && is_background_transaction(*p_src)) return; if (ext.is_clean() && !ext.is_placeholder()) { lru.move_to_top(ext); diff --git a/src/crimson/os/seastore/journal/segmented_journal.cc b/src/crimson/os/seastore/journal/segmented_journal.cc index 12fc3b86d94..f8b8539738d 100644 --- a/src/crimson/os/seastore/journal/segmented_journal.cc +++ b/src/crimson/os/seastore/journal/segmented_journal.cc @@ -181,7 +181,7 @@ SegmentedJournal::scan_last_segment( } for (auto &record_header : *maybe_headers) { ceph_assert(is_valid_transaction(record_header.type)); - if (is_cleaner_transaction(record_header.type)) { + if (is_background_transaction(record_header.type)) { has_tail_delta = true; } } diff --git a/src/crimson/os/seastore/seastore_types.cc b/src/crimson/os/seastore/seastore_types.cc index e14cab14555..18d7be8ade1 100644 --- a/src/crimson/os/seastore/seastore_types.cc +++ b/src/crimson/os/seastore/seastore_types.cc @@ -397,12 +397,12 @@ std::ostream &operator<<(std::ostream &os, transaction_type_t type) return os << "MUTATE"; case transaction_type_t::READ: return os << "READ"; - case transaction_type_t::CLEANER_TRIM_DIRTY: - return os << "CLEANER_TRIM_DIRTY"; - case transaction_type_t::CLEANER_TRIM_ALLOC: - return os << "CLEANER_TRIM_ALLOC"; - case transaction_type_t::CLEANER_RECLAIM: - return os << "CLEANER_RECLAIM"; + case transaction_type_t::TRIM_DIRTY: + return os << "TRIM_DIRTY"; + case transaction_type_t::TRIM_ALLOC: + return os << "TRIM_ALLOC"; + case transaction_type_t::CLEANER: + return os << "CLEANER"; case transaction_type_t::MAX: return os << "TRANS_TYPE_NULL"; default: diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index 0b3b6b1f402..51ed6621663 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -1662,9 +1662,9 @@ std::ostream &operator<<(std::ostream &out, const segment_tail_t &tail); enum class transaction_type_t : uint8_t { MUTATE = 0, READ, // including weak and non-weak read transactions - CLEANER_TRIM_DIRTY, - CLEANER_TRIM_ALLOC, - CLEANER_RECLAIM, + TRIM_DIRTY, + TRIM_ALLOC, + CLEANER, MAX }; @@ -1679,14 +1679,14 @@ constexpr bool is_valid_transaction(transaction_type_t type) { return type < transaction_type_t::MAX; } -constexpr bool is_cleaner_transaction(transaction_type_t type) { - return (type >= transaction_type_t::CLEANER_TRIM_DIRTY && +constexpr bool is_background_transaction(transaction_type_t type) { + return (type >= transaction_type_t::TRIM_DIRTY && type < transaction_type_t::MAX); } constexpr bool is_trim_transaction(transaction_type_t type) { - return (type == transaction_type_t::CLEANER_TRIM_DIRTY || - type == transaction_type_t::CLEANER_TRIM_ALLOC); + return (type == transaction_type_t::TRIM_DIRTY || + type == transaction_type_t::TRIM_ALLOC); } struct record_size_t {