From: Xuehan Xu Date: Tue, 24 Dec 2024 07:24:14 +0000 (+0800) Subject: osd/DynamicPerfStats: remove the dependency on classic osds X-Git-Tag: v20.0.0~86^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89d79344f93d7790a2180b20d965a251bfb302c4;p=ceph.git osd/DynamicPerfStats: remove the dependency on classic osds Signed-off-by: Xuehan Xu --- diff --git a/src/osd/DynamicPerfStats.h b/src/osd/DynamicPerfStats.h index 1c6c26c712d..c9ea7d09517 100644 --- a/src/osd/DynamicPerfStats.h +++ b/src/osd/DynamicPerfStats.h @@ -7,8 +7,6 @@ #include "include/random.h" #include "messages/MOSDOp.h" #include "mgr/OSDPerfMetricTypes.h" -#include "osd/OSD.h" -#include "osd/OpRequest.h" class DynamicPerfStats { public: @@ -54,7 +52,8 @@ public: return !data.empty(); } - void add(const OSDService *osd, const pg_info_t &pg_info, const OpRequest& op, + template + void add(int osd, const pg_info_t &pg_info, const OpRequest& op, uint64_t inb, uint64_t outb, const utime_t &latency) { auto update_counter_fnc = @@ -111,18 +110,22 @@ public: }; auto get_subkey_fnc = - [&osd, &pg_info, &op](const OSDPerfMetricSubKeyDescriptor &d, + [osd, &pg_info, &op](const OSDPerfMetricSubKeyDescriptor &d, OSDPerfMetricSubKey *sub_key) { ceph_assert(d.is_supported()); - auto m = op.get_req(); + auto m = op.template get_req(); std::string match_string; switch(d.type) { case OSDPerfMetricSubKeyType::CLIENT_ID: match_string = stringify(m->get_reqid().name); break; case OSDPerfMetricSubKeyType::CLIENT_ADDRESS: +#ifdef WITH_SEASTAR + match_string = stringify(op.get_connection()->get_peer_addr()); +#else match_string = stringify(m->get_connection()->get_peer_addr()); +#endif break; case OSDPerfMetricSubKeyType::POOL_ID: match_string = stringify(m->get_spg().pool()); @@ -131,7 +134,7 @@ public: match_string = m->get_hobj().nspace; break; case OSDPerfMetricSubKeyType::OSD_ID: - match_string = stringify(osd->get_nodeid()); + match_string = stringify(osd); break; case OSDPerfMetricSubKeyType::PG_ID: match_string = stringify(pg_info.pgid); diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index baa50704938..877cdcaa32e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4465,7 +4465,7 @@ void PrimaryLogPG::log_op_stats(const OpRequest& op, << " lat " << latency << dendl; if (m_dynamic_perf_stats.is_enabled()) { - m_dynamic_perf_stats.add(osd, info, op, inb, outb, latency); + m_dynamic_perf_stats.add(osd->get_nodeid(), info, op, inb, outb, latency); } }