From 3fa0b0ce919da36885cf562fed25314c64851bdc Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 6 Apr 2023 04:23:23 +0000 Subject: [PATCH] osd/: move PGRecoveryMsg check from osd into PGRecoveryMsg::is_recovery_msg Signed-off-by: Samuel Just --- src/osd/OSD.cc | 3 +-- src/osd/scheduler/OpSchedulerItem.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 84c958acde3b1..de9ff3e5fa42a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9845,8 +9845,7 @@ void OSD::enqueue_op(spg_t pg, OpRequestRef&& op, epoch_t epoch) op->mark_queued_for_pg(); logger->tinc(l_osd_op_before_queue_op_lat, latency); - if (type == MSG_OSD_PG_PUSH || - type == MSG_OSD_PG_PUSH_REPLY) { + if (PGRecoveryMsg::is_recovery_msg(op)) { op_shardedwq.queue( OpSchedulerItem( unique_ptr(new PGRecoveryMsg(pg, std::move(op))), diff --git a/src/osd/scheduler/OpSchedulerItem.h b/src/osd/scheduler/OpSchedulerItem.h index a60dcb3fbd01f..70d00d88ad999 100644 --- a/src/osd/scheduler/OpSchedulerItem.h +++ b/src/osd/scheduler/OpSchedulerItem.h @@ -561,6 +561,16 @@ class PGRecoveryMsg : public PGOpQueueable { public: PGRecoveryMsg(spg_t pg, OpRequestRef op) : PGOpQueueable(pg), op(std::move(op)) {} + static bool is_recovery_msg(OpRequestRef &op) { + switch (op->get_req()->get_type()) { + case MSG_OSD_PG_PUSH: + case MSG_OSD_PG_PUSH_REPLY: + return true; + default: + return false; + } + } + std::ostream &print(std::ostream &rhs) const final { return rhs << "PGRecoveryMsg(op=" << *(op->get_req()) << ")"; } -- 2.39.5