From: Radosław Zarzyński Date: Tue, 19 Sep 2023 12:51:53 +0000 (+0200) Subject: osd: ReadPipeline doesn't depend on classical ECBackend at all X-Git-Tag: v19.1.0~295^2~28 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=98f9a254ec5133d60f7da2d6144de667931cbe7a;p=ceph.git osd: ReadPipeline doesn't depend on classical ECBackend at all Signed-off-by: Radosław Zarzyński --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index a19e95cba9d1c..6750a8a538d80 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -634,7 +634,7 @@ void ECBackend::continue_recovery_op( } map>> to_read; - int r = get_min_avail_to_read_shards( + int r = read_pipeline.get_min_avail_to_read_shards( op.hoid, want, true, false, &to_read); if (r != 0) { // we must have lost a recovery source @@ -1728,7 +1728,7 @@ void ECCommon::ReadPipeline::get_all_avail_shards( } } -int ECBackend::get_min_avail_to_read_shards( +int ECCommon::ReadPipeline::get_min_avail_to_read_shards( const hobject_t &hoid, const set &want, bool for_recovery, @@ -1742,7 +1742,7 @@ int ECBackend::get_min_avail_to_read_shards( map shards; set error_shards; - read_pipeline.get_all_avail_shards(hoid, error_shards, have, shards, for_recovery); + get_all_avail_shards(hoid, error_shards, have, shards, for_recovery); map>> need; int r = ec_impl->minimum_to_decode(want, have, &need); @@ -2478,11 +2478,20 @@ void ECBackend::objects_read_and_reconstruct( GenContextURef > &&> &&func) { return read_pipeline.objects_read_and_reconstruct( - *this, reads, fast_read, std::move(func)); + reads, fast_read, std::move(func)); +} + +void ECCommon::ReadPipeline::get_want_to_read_shards( + std::set *want_to_read) const +{ + const std::vector &chunk_mapping = ec_impl->get_chunk_mapping(); + for (int i = 0; i < (int)ec_impl->get_data_chunk_count(); ++i) { + int chunk = (int)chunk_mapping.size() > i ? chunk_mapping[i] : i; + want_to_read->insert(chunk); + } } void ECCommon::ReadPipeline::objects_read_and_reconstruct( - ECBackend& ec_backend, const map > > &reads, @@ -2498,12 +2507,12 @@ void ECCommon::ReadPipeline::objects_read_and_reconstruct( map> obj_want_to_read; set want_to_read; - ec_backend.get_want_to_read_shards(&want_to_read); + get_want_to_read_shards(&want_to_read); map for_read_op; for (auto &&to_read: reads) { map>> shards; - int r = ec_backend.get_min_avail_to_read_shards( + int r = get_min_avail_to_read_shards( to_read.first, want_to_read, false, diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 30b6f017f9681..ae169fd8ff34f 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -90,12 +90,12 @@ struct RecoveryMessages; virtual spg_t primary_spg_t() const = 0; virtual const PGLog &get_log() const = 0; virtual DoutPrefixProvider *get_dpp() = 0; + // XXX virtual void apply_stats( const hobject_t &soid, const object_stat_sum_t &delta_stats) = 0; }; -struct ECBackend; struct ECCommon { struct read_request_t { const std::list > to_read; @@ -237,7 +237,6 @@ struct ECCommon { }; struct ReadPipeline { void objects_read_and_reconstruct( - ECBackend& ecbackend, const std::map > > &reads, bool fast_read, @@ -315,6 +314,17 @@ struct ECCommon { friend ostream &operator<<(ostream &lhs, const ReadOp &rhs); friend struct FinishReadOp; + + void get_want_to_read_shards(std::set *want_to_read) const; + + /// Returns to_read replicas sufficient to reconstruct want + int get_min_avail_to_read_shards( + const hobject_t &hoid, ///< [in] object + const std::set &want, ///< [in] desired shards + bool for_recovery, ///< [in] true if we may use non-acting replicas + bool do_redundant_reads, ///< [in] true if we want to issue redundant reads to reduce latency + std::map>> *to_read ///< [out] shards, corresponding subchunks to read + ); ///< @return error code, 0 on success }; }; @@ -445,16 +455,6 @@ private: sinfo.get_stripe_width()); } -public: - void get_want_to_read_shards(std::set *want_to_read) const { - const std::vector &chunk_mapping = ec_impl->get_chunk_mapping(); - for (int i = 0; i < (int)ec_impl->get_data_chunk_count(); ++i) { - int chunk = (int)chunk_mapping.size() > i ? chunk_mapping[i] : i; - want_to_read->insert(chunk); - } - } -private: - /** * Recovery * @@ -831,15 +831,6 @@ public: ceph::ErasureCodeInterfaceRef ec_impl, uint64_t stripe_width); - /// Returns to_read replicas sufficient to reconstruct want - int get_min_avail_to_read_shards( - const hobject_t &hoid, ///< [in] object - const std::set &want, ///< [in] desired shards - bool for_recovery, ///< [in] true if we may use non-acting replicas - bool do_redundant_reads, ///< [in] true if we want to issue redundant reads to reduce latency - std::map>> *to_read ///< [out] shards, corresponding subchunks to read - ); ///< @return error code, 0 on success - int objects_get_attrs( const hobject_t &hoid, std::map> *out) override;