From 7c01f8b0ef567f211e8e6bd198c8244b3bde1202 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 30 Sep 2022 11:12:31 -0700 Subject: [PATCH] crimson/osd/pg_shard_manager: introduce invoke_on_each_shard_seq Signed-off-by: Samuel Just --- src/crimson/osd/pg_shard_manager.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/crimson/osd/pg_shard_manager.h b/src/crimson/osd/pg_shard_manager.h index 37b98795a8e..c552356cdc6 100644 --- a/src/crimson/osd/pg_shard_manager.h +++ b/src/crimson/osd/pg_shard_manager.h @@ -227,6 +227,23 @@ public: seastar::future> get_pg_stats() const; + /** + * invoke_method_on_each_shard_seq + * + * Invokes shard_services method on each shard sequentially. + */ + 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); + }); + } + /** * for_each_pg * @@ -235,8 +252,7 @@ public: */ template seastar::future<> for_each_pg(F &&f) const { - return sharded_map_seq( - shard_services, + return invoke_on_each_shard_seq( [f=std::move(f)](const auto &local_service) mutable { for (auto &pg: local_service.local_state.pg_map.get_pgs()) { std::apply(f, pg); -- 2.47.3