From: Samuel Just Date: Tue, 30 Aug 2022 22:00:37 +0000 (-0700) Subject: crimson/osd: replace global tid with unique core-local tids X-Git-Tag: v18.1.0~1115^2~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b52990c626628e3c74821b2127d81931ea2eee13;p=ceph.git crimson/osd: replace global tid with unique core-local tids We don't really want a global counter here if we can avoid it. Instead, assign tids with core-local counters prefixed with the core id. We continue to ensure that tids are unique within an osd boot, but lose the property that sucessive tids on different cores are ordered. I don't see anything relying on that property, however, so this should be fine. Signed-off-by: Samuel Just --- diff --git a/src/crimson/osd/shard_services.cc b/src/crimson/osd/shard_services.cc index 4a1f84aa318a..912ac8faae5e 100644 --- a/src/crimson/osd/shard_services.cc +++ b/src/crimson/osd/shard_services.cc @@ -39,7 +39,10 @@ PerShardState::PerShardState( : whoami(whoami), store(store), throttler(crimson::common::local_conf()), - obc_registry(crimson::common::local_conf()) + obc_registry(crimson::common::local_conf()), + next_tid( + static_cast(seastar::this_shard_id()) << + (std::numeric_limits::digits - 8)) { perf = build_osd_logger(&cct); cct.get_perfcounters_collection()->add(perf); diff --git a/src/crimson/osd/shard_services.h b/src/crimson/osd/shard_services.h index ca0ae397cb0f..f872abe3611e 100644 --- a/src/crimson/osd/shard_services.h +++ b/src/crimson/osd/shard_services.h @@ -123,6 +123,13 @@ class PerShardState { return std::make_pair(std::move(op), std::move(fut)); } + // tids for ops i issue, prefixed with core id to ensure uniqueness + ceph_tid_t next_tid; + ceph_tid_t get_tid() { + return next_tid++; + } + +public: PerShardState( int whoami, crimson::os::FuturizedStore &store); @@ -174,12 +181,6 @@ public: crimson::mgr::Client &mgrc; - // tids for ops i issue - unsigned int next_tid{0}; - ceph_tid_t get_tid() { - return (ceph_tid_t)next_tid++; - } - std::unique_ptr meta_coll; template void init_meta_coll(Args&&... args) { @@ -352,6 +353,9 @@ public: return dispatch_context({}, std::move(ctx)); } + /// Return per-core tid + ceph_tid_t get_tid() { return local_state.get_tid(); } + /// Return core-local pg count * number of cores unsigned get_num_local_pgs() const { return local_state.pg_map.get_pg_count(); @@ -377,7 +381,6 @@ public: FORWARD(with_throttle_while, with_throttle_while, local_state.throttler) FORWARD_TO_OSD_SINGLETON(osdmap_subscribe) - FORWARD_TO_OSD_SINGLETON(get_tid) FORWARD_TO_OSD_SINGLETON(queue_want_pg_temp) FORWARD_TO_OSD_SINGLETON(remove_want_pg_temp) FORWARD_TO_OSD_SINGLETON(requeue_pg_temp)