From: Kefu Chai Date: Mon, 8 Jun 2026 09:17:26 +0000 (+0800) Subject: crimson/osd: init PerShardState::startup_time per-shard X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1879f2470b70f58e7d68408671faaea7b950a575;p=ceph.git crimson/osd: init PerShardState::startup_time per-shard previously, we got the mono_clock::now() in OSD::start() and passed it to PerShardState. this worked fine. but it was a little bit convoluted -- we pass the startup_time all the way to PerShardState. in this change, we just use call mono_clock::now() in the contructor of PerShardState. simpler this way. the startup_time has two consumers: - the PGs hosted by the sharded_service use it as a reference for the monotonic timestamp - Heartbeat::send_heartbeats() uses it as for the mono_ping_stamp. because, strictly speaking, we cannot gurantee that all PerShardState sharded services share the identical startup timestamp, as they are constructed on different shards. but this does not matter, as PGs always use the hosting shard service for the referencing timestamp, and OSD always uses the shard service on local shard for sending heartbeats. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index c7288bef612..be62e7eef50 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -500,13 +500,11 @@ seastar::future<> OSD::start() whoami, std::ref(*cluster_msgr), std::ref(*public_msgr), std::ref(*monc), std::ref(*mgrc)); co_await osd_states.start(); - ceph::mono_time startup_time = ceph::mono_clock::now(); co_await shard_services.start( std::ref(osd_singleton_state), std::ref(pg_to_shard_mappings), store_shards_num, whoami, - startup_time, osd_singleton_state.local().perf, osd_singleton_state.local().recoverystate_perf, std::ref(store), diff --git a/src/crimson/osd/shard_services.cc b/src/crimson/osd/shard_services.cc index 3780cd626c6..c75717a77f6 100644 --- a/src/crimson/osd/shard_services.cc +++ b/src/crimson/osd/shard_services.cc @@ -34,7 +34,6 @@ namespace crimson::osd { PerShardState::PerShardState( int whoami, - ceph::mono_time startup_time, PerfCounters *perf, PerfCounters *recoverystate_perf, crimson::os::FuturizedStore &store, @@ -50,7 +49,7 @@ PerShardState::PerShardState( // ids generated by different shards are disjoint static_cast(seastar::this_shard_id()) << (std::numeric_limits::digits - 8)), - startup_time(startup_time), + startup_time(ceph::mono_clock::now()), ec_extent_cache_lru(crimson::common::local_conf().get_val("ec_extent_cache_size")) {} diff --git a/src/crimson/osd/shard_services.h b/src/crimson/osd/shard_services.h index 19717ee55ef..3f0e28c7942 100644 --- a/src/crimson/osd/shard_services.h +++ b/src/crimson/osd/shard_services.h @@ -217,7 +217,6 @@ class PerShardState { public: PerShardState( int whoami, - ceph::mono_time startup_time, PerfCounters *perf, PerfCounters *recoverystate_perf, crimson::os::FuturizedStore &store,