From 6b04d7bc6cc38496279bc7cf0a29501c8209d31f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 12 Feb 2025 19:48:18 -0800 Subject: [PATCH] osd/scheduler/mClockScheduler: move constructor to header Signed-off-by: Samuel Just (cherry picked from commit 35b6176d90e1c48ba899b9ed0fd807ad8b290e0d) --- src/osd/scheduler/mClockScheduler.cc | 35 ---------------------------- src/osd/scheduler/mClockScheduler.h | 32 +++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/osd/scheduler/mClockScheduler.cc b/src/osd/scheduler/mClockScheduler.cc index a79c8e10758d5..20df2b37d340c 100644 --- a/src/osd/scheduler/mClockScheduler.cc +++ b/src/osd/scheduler/mClockScheduler.cc @@ -114,41 +114,6 @@ void mClockScheduler::_init_logger() logger->set(l_mclock_all_type_queue_len, 0); } -mClockScheduler::mClockScheduler(CephContext *cct, - int whoami, - uint32_t num_shards, - int shard_id, - bool is_rotational, - unsigned cutoff_priority, - MonClient *monc, - bool init_perfcounter) - : cct(cct), - whoami(whoami), - num_shards(num_shards), - shard_id(shard_id), - is_rotational(is_rotational), - cutoff_priority(cutoff_priority), - monc(monc), - logger(nullptr), - scheduler( - std::bind(&mClockScheduler::ClientRegistry::get_info, - &client_registry, - _1), - dmc::AtLimit::Wait, - cct->_conf.get_val("osd_mclock_scheduler_anticipation_timeout")) -{ - cct->_conf.add_observer(this); - ceph_assert(num_shards > 0); - set_osd_capacity_params_from_config(); - set_config_defaults_from_profile(); - client_registry.update_from_config( - cct->_conf, osd_bandwidth_capacity_per_shard); - - if (init_perfcounter) { - _init_logger(); - } -} - /* ClientRegistry holds the dmclock::ClientInfo configuration parameters * (reservation (bytes/second), weight (unitless), limit (bytes/second)) * for each IO class in the OSD (client, background_recovery, diff --git a/src/osd/scheduler/mClockScheduler.h b/src/osd/scheduler/mClockScheduler.h index bae80202f8a91..84170adaaeb20 100644 --- a/src/osd/scheduler/mClockScheduler.h +++ b/src/osd/scheduler/mClockScheduler.h @@ -228,9 +228,37 @@ class mClockScheduler : public OpScheduler, md_config_obs_t { void set_config_defaults_from_profile(); public: - mClockScheduler(CephContext *cct, int whoami, uint32_t num_shards, + mClockScheduler( + CephContext *cct, int whoami, uint32_t num_shards, int shard_id, bool is_rotational, unsigned cutoff_priority, - MonClient *monc, bool init_perfcounter=true); + MonClient *monc, + bool init_perfcounter=true) + : cct(cct), + whoami(whoami), + num_shards(num_shards), + shard_id(shard_id), + is_rotational(is_rotational), + cutoff_priority(cutoff_priority), + monc(monc), + logger(nullptr), + scheduler( + std::bind(&mClockScheduler::ClientRegistry::get_info, + &client_registry, + std::placeholders::_1), + crimson::dmclock::AtLimit::Wait, + cct->_conf.get_val("osd_mclock_scheduler_anticipation_timeout")) + { + cct->_conf.add_observer(this); + ceph_assert(num_shards > 0); + set_osd_capacity_params_from_config(); + set_config_defaults_from_profile(); + client_registry.update_from_config( + cct->_conf, osd_bandwidth_capacity_per_shard); + + if (init_perfcounter) { + _init_logger(); + } + } ~mClockScheduler() override; /// Calculate scaled cost per item -- 2.39.5