]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/common/smp_helpers: cleanup sharded_map_seq
authorMatan Breizman <mbreizma@redhat.com>
Mon, 23 Jun 2025 10:18:23 +0000 (10:18 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 25 Jun 2025 16:41:44 +0000 (19:41 +0300)
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 <mbreizma@redhat.com>
(cherry picked from commit 87d20855809d29d675b44f0f97a2ca859f5bf431)

src/crimson/admin/osd_admin.cc
src/crimson/common/smp_helpers.h
src/crimson/osd/pg_shard_manager.h

index 5a290c8b37426b74021005ee52ea07bb9106353a..56fa45417e761f9b6d31fc8bbbc320482c0d7906 100644 (file)
@@ -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();
index 70ba701bcd22a389ff0aefd4bdb520036a9f9f33..435b386821b42d91ba9d57abd2502795023aaa85 100644 (file)
@@ -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 <typename T, typename F>
-auto sharded_map_seq(T &t, F &&f) {
-  return invoke_on_all_seq(
-    [&t, f=std::forward<F>(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
index b9aa7c631818621f00eb9e53cdd854896769abac..4e8ddb82502baa0cae7f45cbe8139ae547e73b20 100644 (file)
@@ -303,17 +303,16 @@ public:
    * invoke_method_on_each_shard_seq
    *
    * Invokes shard_services method on each shard sequentially.
+   * Following sharded<Service>::invoke_on_all but invoke_on_all_seq
+   * is used to support errorated return types.
    */
   template <typename F, typename... Args>
   seastar::future<> invoke_on_each_shard_seq(
     F &&f) const {
-    return sharded_map_seq(
-      shard_services,
-      [f=std::forward<F>(f)](const ShardServices &shard_services) mutable {
-       return std::invoke(
-         f,
-         shard_services);
-      });
+    return invoke_on_all_seq(
+      [this, f=std::forward<F>(f)]() mutable {
+      return std::invoke(f, shard_services.local());
+    });
   }
 
   /**