From 36cc47e69cd7962b472e9227515ae960b045df31 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 5 Nov 2020 15:29:15 -0800 Subject: [PATCH] crimson/os/seastore/journal: propogate segment headers with replay segments Signed-off-by: Samuel Just --- src/crimson/os/seastore/journal.cc | 10 +++++----- src/crimson/os/seastore/journal.h | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crimson/os/seastore/journal.cc b/src/crimson/os/seastore/journal.cc index 0b1d420b794..b5bbe1d7d73 100644 --- a/src/crimson/os/seastore/journal.cc +++ b/src/crimson/os/seastore/journal.cc @@ -315,7 +315,7 @@ Journal::find_replay_segments_fut Journal::find_replay_segments() } else { replay_from = paddr_t{from->first, (segment_off_t)block_size}; } - auto ret = std::vector(segments.end() - from); + auto ret = replay_segments_t(segments.end() - from); std::transform( from, segments.end(), ret.begin(), [this](const auto &p) { @@ -325,9 +325,9 @@ Journal::find_replay_segments_fut Journal::find_replay_segments() logger().debug( "Journal::find_replay_segments: replaying from {}", ret); - return ret; + return std::make_pair(ret, p.second); }); - ret[0].offset = replay_from; + ret[0].first.offset = replay_from; return find_replay_segments_fut( find_replay_segments_ertr::ready_future_marker{}, std::move(ret)); @@ -460,14 +460,14 @@ Journal::replay_segment( Journal::replay_ret Journal::replay(delta_handler_t &&delta_handler) { return seastar::do_with( - std::move(delta_handler), std::vector(), + std::move(delta_handler), replay_segments_t(), [this](auto &handler, auto &segments) mutable -> replay_ret { return find_replay_segments().safe_then( [this, &handler, &segments](auto replay_segs) mutable { logger().debug("replay: found {} segments", replay_segs.size()); segments = std::move(replay_segs); return crimson::do_for_each(segments, [this, &handler](auto i) mutable { - return replay_segment(i, handler); + return replay_segment(i.first, handler); }); }); }); diff --git a/src/crimson/os/seastore/journal.h b/src/crimson/os/seastore/journal.h index ee7bf9e9ea8..c925233b08f 100644 --- a/src/crimson/os/seastore/journal.h +++ b/src/crimson/os/seastore/journal.h @@ -284,11 +284,13 @@ private: bool needs_roll(segment_off_t length) const; /// return ordered vector of segments to replay + using replay_segments_t = std::vector< + std::pair>; using find_replay_segments_ertr = crimson::errorator< crimson::ct_error::input_output_error >; using find_replay_segments_fut = find_replay_segments_ertr::future< - std::vector>; + replay_segments_t>; find_replay_segments_fut find_replay_segments(); /// read record metadata for record starting at start