diff options
author | Yingxin Cheng <yingxin.cheng@intel.com> | 2022-08-30 06:13:18 +0200 |
---|---|---|
committer | Yingxin Cheng <yingxin.cheng@intel.com> | 2022-09-05 03:43:25 +0200 |
commit | 32def5891011d52ca331d33b240c5f382cdd9186 (patch) | |
tree | 5bf43c713839e444464481e1bdd85299a0cc25b4 /src/crimson/os/seastore/async_cleaner.h | |
parent | crimson/os/seastore/async_cleaner: move the related stats to GCProcess (diff) | |
download | ceph-32def5891011d52ca331d33b240c5f382cdd9186.tar.xz ceph-32def5891011d52ca331d33b240c5f382cdd9186.zip |
crimson/os/seastore/async_cleaner: make trimmer optional to cleaner
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
Diffstat (limited to 'src/crimson/os/seastore/async_cleaner.h')
-rw-r--r-- | src/crimson/os/seastore/async_cleaner.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/crimson/os/seastore/async_cleaner.h b/src/crimson/os/seastore/async_cleaner.h index f535b86c2c6..fd4db866e27 100644 --- a/src/crimson/os/seastore/async_cleaner.h +++ b/src/crimson/os/seastore/async_cleaner.h @@ -896,7 +896,8 @@ private: seastar::metrics::metric_group metrics; void register_metrics(); - JournalTrimmerImpl *trimmer; + // optional, set if this cleaner is assigned to SegmentedJournal + JournalTrimmer *trimmer = nullptr; ExtentCallbackInterface *ecb = nullptr; @@ -923,6 +924,10 @@ public: gc_process.set_extent_callback(cb); } + void set_journal_trimmer(JournalTrimmer &_trimmer) { + trimmer = &_trimmer; + } + using mount_ertr = base_ertr; using mount_ret = mount_ertr::future<>; mount_ret mount(); @@ -953,6 +958,8 @@ public: void close_segment(segment_id_t segment) final; void update_segment_avail_bytes(segment_type_t type, paddr_t offset) final { + assert(type == segment_type_t::OOL || + trimmer != nullptr); // segment_type_t::JOURNAL segments.update_written_to(type, offset); gc_process.maybe_wake_background(); } @@ -1204,10 +1211,10 @@ private: * Segments calculations */ std::size_t get_segments_in_journal() const { - if (trimmer->get_journal_type() == journal_type_t::CIRCULAR) { - return 0; - } else { + if (trimmer != nullptr) { return trimmer->get_num_rolls(); + } else { + return 0; } } std::size_t get_segments_in_journal_closed() const { @@ -1315,6 +1322,8 @@ private: data_category_t category, reclaim_gen_t generation) { ceph_assert(state == cleaner_state_t::MOUNT); + ceph_assert(s_type == segment_type_t::OOL || + trimmer != nullptr); // segment_type_t::JOURNAL auto old_usage = calc_utilization(segment); segments.init_closed(segment, seq, s_type, category, generation); auto new_usage = calc_utilization(segment); |