Skip to content

Commit 87d2085

Browse files
committed
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 <[email protected]>
1 parent 0b686b4 commit 87d2085

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

src/crimson/admin/osd_admin.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ class DumpInFlightOpsHook : public AdminSocketHook {
584584
fref->open_array_section("ops_in_flight");
585585
co_await pg_shard_manager.when_active();
586586
co_await pg_shard_manager.invoke_on_each_shard_seq(
587-
[f = fref.get()](const auto &shard_services) {
588-
return shard_services.dump_ops_in_flight(f);
587+
[f = fref.get()](const auto &local_service) {
588+
return local_service.dump_ops_in_flight(f);
589589
});
590590
fref->close_section();
591591
fref->close_section();

src/crimson/common/smp_helpers.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,6 @@ auto invoke_on_all_seq(F f) -> decltype(seastar::futurize_invoke(f)) {
6565
}
6666
}
6767

68-
/**
69-
* sharded_map_seq
70-
*
71-
* Invokes f on each shard of t sequentially. Caller may assume that
72-
* f will not be invoked concurrently on multiple cores.
73-
*/
74-
template <typename T, typename F>
75-
auto sharded_map_seq(T &t, F &&f) {
76-
return invoke_on_all_seq(
77-
[&t, f=std::forward<F>(f)]() mutable {
78-
return std::invoke(f, t.local());
79-
});
80-
}
81-
8268
enum class crosscore_type_t {
8369
ONE, // from 1 to 1 core
8470
ONE_N, // from 1 to n cores

src/crimson/osd/pg_shard_manager.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,16 @@ class PGShardManager {
303303
* invoke_method_on_each_shard_seq
304304
*
305305
* Invokes shard_services method on each shard sequentially.
306+
* Following sharded<Service>::invoke_on_all but invoke_on_all_seq
307+
* is used to support errorated return types.
306308
*/
307309
template <typename F, typename... Args>
308310
seastar::future<> invoke_on_each_shard_seq(
309311
F &&f) const {
310-
return sharded_map_seq(
311-
shard_services,
312-
[f=std::forward<F>(f)](const ShardServices &shard_services) mutable {
313-
return std::invoke(
314-
f,
315-
shard_services);
316-
});
312+
return invoke_on_all_seq(
313+
[this, f=std::forward<F>(f)]() mutable {
314+
return std::invoke(f, shard_services.local());
315+
});
317316
}
318317

319318
/**

0 commit comments

Comments
 (0)