]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: init PerShardState::startup_time per-shard 69329/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 8 Jun 2026 09:17:26 +0000 (17:17 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 9 Jun 2026 07:30:29 +0000 (15:30 +0800)
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 <k.chai@proxmox.com>
src/crimson/osd/osd.cc
src/crimson/osd/shard_services.cc
src/crimson/osd/shard_services.h

index c7288bef6126004b60ff7792ebc036abbdd752e2..be62e7eef50816870f4afa71717bbbb204d2995c 100644 (file)
@@ -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),
index 3780cd626c643f66af49661d9f61888e991e1222..c75717a77f6ca554339c768c0066c7c8783cb218 100644 (file)
@@ -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<ceph_tid_t>(seastar::this_shard_id()) <<
       (std::numeric_limits<ceph_tid_t>::digits - 8)),
-    startup_time(startup_time),
+    startup_time(ceph::mono_clock::now()),
     ec_extent_cache_lru(crimson::common::local_conf().get_val<uint64_t>("ec_extent_cache_size"))
 {}
 
index 19717ee55ef1d448eef2f5afe9be15cbdab5abfc..3f0e28c79426305dd8b96074bf88646455f461f9 100644 (file)
@@ -217,7 +217,6 @@ class PerShardState {
 public:
   PerShardState(
     int whoami,
-    ceph::mono_time startup_time,
     PerfCounters *perf,
     PerfCounters *recoverystate_perf,
     crimson::os::FuturizedStore &store,