]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/operation: generalized for multiple reactors
authorSamuel Just <sjust@redhat.com>
Thu, 1 Sep 2022 23:08:08 +0000 (16:08 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 21 Sep 2022 17:37:22 +0000 (10:37 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/operation.h
src/crimson/osd/osd_operation.cc

index 220cc64d1341d50641e12a54dcaaea7f9fc64522..e079502cbf5187578ce7cfa5679b173926b55ca2 100644 (file)
@@ -414,7 +414,16 @@ protected:
                         return opl.empty();
                       });
   }
+
 public:
+  OperationRegistryT(core_id_t core) {
+    // Use core to initialize upper 8 bits of counters to ensure that
+    // ids generated by different cores are disjoint
+    op_id_counters.fill(
+      static_cast<id_t>(core) <<
+      (std::numeric_limits<id_t>::digits - 8));
+  }
+
   template <size_t REGISTRY_INDEX>
   const op_list& get_registry() const {
     static_assert(
@@ -428,6 +437,18 @@ public:
       REGISTRY_INDEX < std::tuple_size<decltype(registries)>::value);
     return registries[REGISTRY_INDEX];
   }
+
+  /// Removes op from registry
+  void remove_from_registry(Operation &op) {
+    const auto op_type = op.get_type();
+    registries[op_type].erase(op_list::s_iterator_to(op));
+  }
+
+  /// Adds op to registry
+  void add_to_registry(Operation &op) {
+    const auto op_type = op.get_type();
+    registries[op_type].push_back(op);
+  }
 };
 
 class PipelineExitBarrierI {
index 63612091cc8b6190b64717943adba4ce634e7fd4..b0620a4ed25e52f47caf6e68c5f0adcaa5099ba9 100644 (file)
@@ -38,6 +38,7 @@ void OSDOperationRegistry::do_stop()
 }
 
 OSDOperationRegistry::OSDOperationRegistry()
+  : OperationRegistryT(seastar::this_shard_id())
 {
   constexpr auto historic_reg_index =
     static_cast<size_t>(OperationTypeCode::historic_client_request);