From: Kefu Chai Date: Thu, 22 Oct 2020 04:40:37 +0000 (+0800) Subject: crimson/osd: add more privacy X-Git-Tag: v16.1.0~794^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F37745%2Fhead;p=ceph.git crimson/osd: add more privacy * reorder the member variable and member function definitions so the private members are listed at the end of class. as requested by the CodingStyle * mark some member variables and member functions private, as long as they are not used by other classes or non-friend classes. * document UrgentRecovery * refactor BackgroundRecovery::get_scheduler_params() to dedup the comments Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/osd_operations/background_recovery.cc b/src/crimson/osd/osd_operations/background_recovery.cc index 40407e708d7d..5a19c71b68d2 100644 --- a/src/crimson/osd/osd_operations/background_recovery.cc +++ b/src/crimson/osd/osd_operations/background_recovery.cc @@ -23,7 +23,9 @@ BackgroundRecovery::BackgroundRecovery( ShardServices &ss, epoch_t epoch_started, crimson::osd::scheduler::scheduler_class_t scheduler_class) - : pg(pg), ss(ss), epoch_started(epoch_started), + : pg(pg), + epoch_started(epoch_started), + ss(ss), scheduler_class(scheduler_class) {} diff --git a/src/crimson/osd/osd_operations/background_recovery.h b/src/crimson/osd/osd_operations/background_recovery.h index 1fa0e1df30e4..37e46c588a84 100644 --- a/src/crimson/osd/osd_operations/background_recovery.h +++ b/src/crimson/osd/osd_operations/background_recovery.h @@ -26,24 +26,32 @@ public: crimson::osd::scheduler::scheduler_class_t scheduler_class); virtual void print(std::ostream &) const; - virtual void dump_detail(Formatter *f) const; seastar::future<> start(); + protected: Ref pg; - ShardServices &ss; - epoch_t epoch_started; - crimson::osd::scheduler::scheduler_class_t scheduler_class; - auto get_scheduler_params(crimson::osd::scheduler::cost_t cost = 1, - crimson::osd::scheduler::client_t owner = 0) const { - return crimson::osd::scheduler::params_t{ - cost, // cost - owner, // owner + const epoch_t epoch_started; + +private: + virtual void dump_detail(Formatter *f) const; + crimson::osd::scheduler::params_t get_scheduler_params() const { + return { + 1, // cost + 0, // owner scheduler_class }; } virtual seastar::future do_recovery() = 0; + ShardServices &ss; + const crimson::osd::scheduler::scheduler_class_t scheduler_class; }; +/// represent a recovery initiated for serving a client request +/// +/// unlike @c PglogBasedRecovery and @c BackfillRecovery, +/// @c UrgentRecovery is not throttled by the scheduler. and it +/// utilizes @c RecoveryBackend directly to recover the unreadable +/// object. class UrgentRecovery final : public BackgroundRecovery { public: UrgentRecovery( @@ -52,31 +60,30 @@ public: Ref pg, ShardServices& ss, epoch_t epoch_started) - : BackgroundRecovery{pg, ss, epoch_started, crimson::osd::scheduler::scheduler_class_t::immediate}, + : BackgroundRecovery{pg, ss, epoch_started, + crimson::osd::scheduler::scheduler_class_t::immediate}, soid{soid}, need(need) {} void print(std::ostream&) const final; - void dump_detail(Formatter* f) const final; + private: + void dump_detail(Formatter* f) const final; + seastar::future do_recovery() override; const hobject_t soid; const eversion_t need; - seastar::future do_recovery() override; }; class PglogBasedRecovery final : public BackgroundRecovery { - seastar::future do_recovery() override; - public: PglogBasedRecovery( Ref pg, ShardServices &ss, epoch_t epoch_started); -}; -class BackfillRecovery final : public BackgroundRecovery { - boost::intrusive_ptr evt; - OrderedPipelinePhase::Handle handle; +private: seastar::future do_recovery() override; +}; +class BackfillRecovery final : public BackgroundRecovery { public: class BackfillRecoveryPipeline { OrderedPipelinePhase process = { @@ -94,6 +101,11 @@ public: const EventT& evt); static BackfillRecoveryPipeline &bp(PG &pg); + +private: + boost::intrusive_ptr evt; + OrderedPipelinePhase::Handle handle; + seastar::future do_recovery() override; }; template