From 6a122c7ecd075df9f35517e15eeb49dad1d75ba7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 5 Mar 2019 17:32:11 +0800 Subject: [PATCH] crimson/osd: handle MOSDPGInfo in OSD will handle it in PG in follow-up changes. Signed-off-by: Kefu Chai --- src/crimson/osd/osd.cc | 23 +++++++++++++++++++++++ src/crimson/osd/osd.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index a81770e9006..98e7e5225d3 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -9,6 +9,7 @@ #include "messages/MOSDBeacon.h" #include "messages/MOSDBoot.h" #include "messages/MOSDMap.h" +#include "messages/MOSDPGInfo.h" #include "messages/MOSDPGLog.h" #include "messages/MOSDPGNotify.h" #include "messages/MPGStats.h" @@ -364,6 +365,8 @@ seastar::future<> OSD::ms_dispatch(ceph::net::ConnectionRef conn, MessageRef m) return handle_osd_map(conn, boost::static_pointer_cast(m)); case MSG_OSD_PG_NOTIFY: return handle_pg_notify(conn, boost::static_pointer_cast(m)); + case MSG_OSD_PG_INFO: + return handle_pg_info(conn, boost::static_pointer_cast(m)); default: return seastar::now(); } @@ -727,6 +730,26 @@ seastar::future<> OSD::handle_pg_notify(ceph::net::ConnectionRef conn, }); } +seastar::future<> OSD::handle_pg_info(ceph::net::ConnectionRef conn, + Ref m) +{ + // assuming all pgs reside in a single shard + // see OSD::dequeue_peering_evt() + const int from = m->get_source().num(); + return seastar::parallel_for_each(m->pg_list, + [from, this](pair p) { + auto& pg_notify = p.first; + spg_t pgid{pg_notify.info.pgid.pgid, pg_notify.to}; + MInfoRec info{pg_shard_t{from, pg_notify.from}, + pg_notify.info, + pg_notify.epoch_sent}; + auto evt = std::make_unique(pg_notify.epoch_sent, + pg_notify.query_epoch, + std::move(info)); + return do_peering_event(pgid, std::move(evt)); + }); +} + seastar::future<> OSD::do_peering_event(spg_t pgid, std::unique_ptr evt) diff --git a/src/crimson/osd/osd.h b/src/crimson/osd/osd.h index 74b80176f86..0445d3c9d9a 100644 --- a/src/crimson/osd/osd.h +++ b/src/crimson/osd/osd.h @@ -128,6 +128,8 @@ private: Ref m); seastar::future<> handle_pg_notify(ceph::net::ConnectionRef conn, Ref m); + seastar::future<> handle_pg_info(ceph::net::ConnectionRef conn, + Ref m); seastar::future<> committed_osd_maps(version_t first, version_t last, -- 2.39.5