]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: replace global tid with unique core-local tids
authorSamuel Just <sjust@redhat.com>
Tue, 30 Aug 2022 22:00:37 +0000 (15:00 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 27 Sep 2022 02:35:41 +0000 (19:35 -0700)
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 <sjust@redhat.com>
src/crimson/osd/shard_services.cc
src/crimson/osd/shard_services.h

index 4a1f84aa318af2a9389c7eb0d5ff48b84097aac4..912ac8faae5ec6bdfc4a5b28e1f4ffc5b6c48071 100644 (file)
@@ -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<ceph_tid_t>(seastar::this_shard_id()) <<
+      (std::numeric_limits<ceph_tid_t>::digits - 8))
 {
   perf = build_osd_logger(&cct);
   cct.get_perfcounters_collection()->add(perf);
index ca0ae397cb0fe4d83f9a7f9957b7df6b5eed0e95..f872abe3611e2022fbc52e5b2dd8714ad20b602f 100644 (file)
@@ -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<OSDMeta> meta_coll;
   template <typename... Args>
   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)