From 952d42a7e9a429a1a26d102f333c9f532e965562 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 9 Apr 2018 21:47:46 -0400 Subject: [PATCH] osd/ECBackend: store the original needed shards in a ReadOp This avoids extra logic recomputing them due to EIO or redundant reads. Signed-off-by: Josh Durgin (cherry picked from commit 0f9474d4e8e54cb8784cc2dbaa50318c2ff8e667) Conflicts: src/osd/ECBackend.cc (trivial) --- src/osd/ECBackend.cc | 10 ++++++++++ src/osd/ECBackend.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 5eccb1887e723..a0fecedda32a7 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -254,14 +254,17 @@ struct OnRecoveryReadComplete : struct RecoveryMessages { map reads; + map> want_to_read; void read( ECBackend *ec, const hobject_t &hoid, uint64_t off, uint64_t len, + set &&_want_to_read, const set &need, bool attrs) { list > to_read; to_read.push_back(boost::make_tuple(off, len, 0)); assert(!reads.count(hoid)); + want_to_read.insert(make_pair(hoid, std::move(_want_to_read))); reads.insert( make_pair( hoid, @@ -526,6 +529,7 @@ void ECBackend::dispatch_recovery_messages(RecoveryMessages &m, int priority) return; start_read_op( priority, + m.want_to_read, m.reads, OpRequestRef(), false, true); @@ -571,6 +575,7 @@ void ECBackend::continue_recovery_op( op.hoid, op.recovery_progress.data_recovered_to, amount, + std::move(want), to_read, op.recovery_progress.first && !op.obc); op.extent_requested = make_pair( @@ -1606,6 +1611,7 @@ int ECBackend::get_remaining_shards( void ECBackend::start_read_op( int priority, + map> &want_to_read, map &to_read, OpRequestRef _op, bool do_redundant_reads, @@ -1621,6 +1627,7 @@ void ECBackend::start_read_op( do_redundant_reads, for_recovery, _op, + std::move(want_to_read), std::move(to_read))).first->second; dout(10) << __func__ << ": starting " << op << dendl; if (_op) { @@ -2274,6 +2281,7 @@ void ECBackend::objects_read_and_reconstruct( return; } + map> obj_want_to_read; set want_to_read; get_want_to_read_shards(&want_to_read); @@ -2301,10 +2309,12 @@ void ECBackend::objects_read_and_reconstruct( shards, false, c))); + obj_want_to_read.insert(make_pair(to_read.first, want_to_read)); } start_read_op( CEPH_MSG_PRIO_DEFAULT, + obj_want_to_read, for_read_op, OpRequestRef(), fast_read, false); diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 8799ec991fc19..7e0c2d08d47cb 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -386,6 +386,7 @@ public: ZTracer::Trace trace; + map> want_to_read; map to_read; map complete; @@ -402,9 +403,11 @@ public: bool do_redundant_reads, bool for_recovery, OpRequestRef op, + map> &&_want_to_read, map &&_to_read) : priority(priority), tid(tid), op(op), do_redundant_reads(do_redundant_reads), - for_recovery(for_recovery), to_read(std::move(_to_read)) { + for_recovery(for_recovery), want_to_read(std::move(_want_to_read)), + to_read(std::move(_to_read)) { for (auto &&hpair: to_read) { auto &returned = complete[hpair.first].returned; for (auto &&extent: hpair.second.to_read) { @@ -430,6 +433,7 @@ public: map > shard_to_read_map; void start_read_op( int priority, + map> &want_to_read, map &to_read, OpRequestRef op, bool do_redundant_reads, bool for_recovery); -- 2.39.5