From 6e2d58a92db3bfb2f86b58587e233a85e42a629e Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 1 Sep 2022 16:08:08 -0700 Subject: [PATCH] crimson/common/operation: generalized for multiple reactors Signed-off-by: Samuel Just --- src/crimson/common/operation.h | 21 +++++++++++++++++++++ src/crimson/osd/osd_operation.cc | 1 + 2 files changed, 22 insertions(+) diff --git a/src/crimson/common/operation.h b/src/crimson/common/operation.h index 220cc64d134..e079502cbf5 100644 --- a/src/crimson/common/operation.h +++ b/src/crimson/common/operation.h @@ -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(core) << + (std::numeric_limits::digits - 8)); + } + template const op_list& get_registry() const { static_assert( @@ -428,6 +437,18 @@ public: REGISTRY_INDEX < std::tuple_size::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 { diff --git a/src/crimson/osd/osd_operation.cc b/src/crimson/osd/osd_operation.cc index 63612091cc8..b0620a4ed25 100644 --- a/src/crimson/osd/osd_operation.cc +++ b/src/crimson/osd/osd_operation.cc @@ -38,6 +38,7 @@ void OSDOperationRegistry::do_stop() } OSDOperationRegistry::OSDOperationRegistry() + : OperationRegistryT(seastar::this_shard_id()) { constexpr auto historic_reg_index = static_cast(OperationTypeCode::historic_client_request);