mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
crimson/osd: update_heartbeat_peers can iterate pgs syncronously
OSDSingletonState has a local inventory of all pgids. Signed-off-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
parent
a9684d4665
commit
cb657b4221
@ -1229,7 +1229,7 @@ seastar::future<> OSD::update_heartbeat_peers()
|
||||
return seastar::now();;
|
||||
}
|
||||
|
||||
return pg_shard_manager.for_each_pg([this](auto &pgid, auto &pg) {
|
||||
pg_shard_manager.for_each_pgid([this](auto &pgid) {
|
||||
vector<int> up, acting;
|
||||
osdmap->pg_to_up_acting_osds(pgid.pgid,
|
||||
&up, nullptr,
|
||||
@ -1241,9 +1241,9 @@ seastar::future<> OSD::update_heartbeat_peers()
|
||||
heartbeat->add_peer(osd, osdmap->get_epoch());
|
||||
}
|
||||
}
|
||||
}).then([this] {
|
||||
heartbeat->update_peers(whoami);
|
||||
});
|
||||
heartbeat->update_peers(whoami);
|
||||
return seastar::now();
|
||||
}
|
||||
|
||||
seastar::future<> OSD::handle_peering_op(
|
||||
|
@ -75,6 +75,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
void for_each_pgid(F &&f) const {
|
||||
for (const auto &i: pg_to_core) {
|
||||
std::invoke(f, i.first);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<core_id_t, unsigned> core_to_num_pgs;
|
||||
std::map<spg_t, core_id_t> pg_to_core;
|
||||
|
@ -240,6 +240,17 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* for_each_pgid
|
||||
*
|
||||
* Syncronously invokes f on each pgid
|
||||
*/
|
||||
template <typename F>
|
||||
void for_each_pgid(F &&f) const {
|
||||
return get_osd_singleton_state().pg_to_shard_mapping.for_each_pgid(
|
||||
std::forward<F>(f));
|
||||
}
|
||||
|
||||
auto get_num_pgs() const {
|
||||
return get_osd_singleton_state().pg_to_shard_mapping.get_num_pgs();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user