From 17d6a993fc17d533460c5f40f3908c708e057c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 18:45:17 +0200 Subject: Merging upstream version 18.2.3. Signed-off-by: Daniel Baumann --- src/osd/scheduler/OpScheduler.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/osd/scheduler/OpScheduler.h') diff --git a/src/osd/scheduler/OpScheduler.h b/src/osd/scheduler/OpScheduler.h index 1575bcae4..570a2a162 100644 --- a/src/osd/scheduler/OpScheduler.h +++ b/src/osd/scheduler/OpScheduler.h @@ -18,6 +18,7 @@ #include #include "common/ceph_context.h" +#include "common/OpQueue.h" #include "mon/MonClient.h" #include "osd/scheduler/OpSchedulerItem.h" @@ -54,6 +55,9 @@ public: // Apply config changes to the scheduler (if any) virtual void update_configuration() = 0; + // Get the scheduler type set for the queue + virtual op_queue_type_t get_type() const = 0; + // Destructor virtual ~OpScheduler() {}; }; @@ -63,7 +67,8 @@ using OpSchedulerRef = std::unique_ptr; OpSchedulerRef make_scheduler( CephContext *cct, int whoami, uint32_t num_shards, int shard_id, - bool is_rotational, std::string_view osd_objectstore, MonClient *monc); + bool is_rotational, std::string_view osd_objectstore, + op_queue_type_t osd_scheduler, unsigned op_queue_cut_off, MonClient *monc); /** * Implements OpScheduler in terms of OpQueue @@ -78,21 +83,10 @@ class ClassedOpQueueScheduler final : public OpScheduler { unsigned cutoff; T queue; - static unsigned int get_io_prio_cut(CephContext *cct) { - if (cct->_conf->osd_op_queue_cut_off == "debug_random") { - srand(time(NULL)); - return (rand() % 2 < 1) ? CEPH_MSG_PRIO_HIGH : CEPH_MSG_PRIO_LOW; - } else if (cct->_conf->osd_op_queue_cut_off == "high") { - return CEPH_MSG_PRIO_HIGH; - } else { - // default / catch-all is 'low' - return CEPH_MSG_PRIO_LOW; - } - } public: template - ClassedOpQueueScheduler(CephContext *cct, Args&&... args) : - cutoff(get_io_prio_cut(cct)), + ClassedOpQueueScheduler(CephContext *cct, unsigned prio_cut, Args&&... args) : + cutoff(prio_cut), queue(std::forward(args)...) {} @@ -143,6 +137,10 @@ public: // no-op } + op_queue_type_t get_type() const final { + return queue.get_type(); + } + ~ClassedOpQueueScheduler() final {}; }; -- cgit v1.2.3