From: Matan Breizman Date: Mon, 23 Jun 2025 10:18:23 +0000 (+0000) Subject: crimson/common/smp_helpers: cleanup sharded_map_seq X-Git-Tag: v20.0.0-pre.ibm~18^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=caf6e5b2b2766b241f2cdf30139613e2497241ff;p=ceph-ci.git crimson/common/smp_helpers: cleanup sharded_map_seq Let PGShardManager::invoke_on_each_shard_seq pass the local shard_services instance instead of using an additional helper. The downside of dropping the generic sharded_map_seq helper is that it is able to support *any* (seastar::)sharded object. However, as shard_services is the only user of it - directly using the local instance without the helper seems easier to read. Signed-off-by: Matan Breizman (cherry picked from commit 87d20855809d29d675b44f0f97a2ca859f5bf431) --- diff --git a/src/crimson/admin/osd_admin.cc b/src/crimson/admin/osd_admin.cc index 5a290c8b374..56fa45417e7 100644 --- a/src/crimson/admin/osd_admin.cc +++ b/src/crimson/admin/osd_admin.cc @@ -584,8 +584,8 @@ public: fref->open_array_section("ops_in_flight"); co_await pg_shard_manager.when_active(); co_await pg_shard_manager.invoke_on_each_shard_seq( - [f = fref.get()](const auto &shard_services) { - return shard_services.dump_ops_in_flight(f); + [f = fref.get()](const auto &local_service) { + return local_service.dump_ops_in_flight(f); }); fref->close_section(); fref->close_section(); diff --git a/src/crimson/common/smp_helpers.h b/src/crimson/common/smp_helpers.h index 70ba701bcd2..435b386821b 100644 --- a/src/crimson/common/smp_helpers.h +++ b/src/crimson/common/smp_helpers.h @@ -65,20 +65,6 @@ auto invoke_on_all_seq(F f) -> decltype(seastar::futurize_invoke(f)) { } } -/** - * sharded_map_seq - * - * Invokes f on each shard of t sequentially. Caller may assume that - * f will not be invoked concurrently on multiple cores. - */ -template -auto sharded_map_seq(T &t, F &&f) { - return invoke_on_all_seq( - [&t, f=std::forward(f)]() mutable { - return std::invoke(f, t.local()); - }); -} - enum class crosscore_type_t { ONE, // from 1 to 1 core ONE_N, // from 1 to n cores diff --git a/src/crimson/osd/pg_shard_manager.h b/src/crimson/osd/pg_shard_manager.h index b9aa7c63181..4e8ddb82502 100644 --- a/src/crimson/osd/pg_shard_manager.h +++ b/src/crimson/osd/pg_shard_manager.h @@ -303,17 +303,16 @@ public: * invoke_method_on_each_shard_seq * * Invokes shard_services method on each shard sequentially. + * Following sharded::invoke_on_all but invoke_on_all_seq + * is used to support errorated return types. */ template seastar::future<> invoke_on_each_shard_seq( F &&f) const { - return sharded_map_seq( - shard_services, - [f=std::forward(f)](const ShardServices &shard_services) mutable { - return std::invoke( - f, - shard_services); - }); + return invoke_on_all_seq( + [this, f=std::forward(f)]() mutable { + return std::invoke(f, shard_services.local()); + }); } /**