From 97e202afb14b58f0867a7fdd6a3deee8d648c822 Mon Sep 17 00:00:00 2001 From: tomershafir Date: Fri, 15 Nov 2024 18:41:40 +0200 Subject: [PATCH] sharded.hh: remove inline from templates Templates are distinctly defined in each translation unit, thus they dont cause multiple definitions linkage error, so inline is redundant code to compile. --- include/seastar/core/sharded.hh | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/include/seastar/core/sharded.hh b/include/seastar/core/sharded.hh index 113926892f..094a32712f 100644 --- a/include/seastar/core/sharded.hh +++ b/include/seastar/core/sharded.hh @@ -400,7 +400,6 @@ public: /// /// \see map_reduce(Iterator begin, Iterator end, Mapper&& mapper, Reducer&& r) template - inline auto map_reduce(Reducer&& r, Func&& func, Args&&... args) -> typename reducer_traits::future_type { auto rng = std::views::iota(size_t(0), _instances.size()); @@ -417,7 +416,6 @@ public: /// The const version of \ref map_reduce(Reducer&& r, Func&& func) template - inline auto map_reduce(Reducer&& r, Func&& func, Args&&... args) const -> typename reducer_traits::future_type { auto rng = std::views::iota(size_t(0), _instances.size()); @@ -449,7 +447,6 @@ public: /// \return Result of invoking `map` with each instance in parallel, reduced by calling /// `reduce()` on each adjacent pair of results. template - inline future map_reduce0(Mapper map, Initial initial, Reduce reduce) { auto wrapped_map = [this, map] (unsigned c) { @@ -466,7 +463,6 @@ public: /// The const version of \ref map_reduce0(Mapper map, Initial initial, Reduce reduce) template - inline future map_reduce0(Mapper map, Initial initial, Reduce reduce) const { auto wrapped_map = [this, map] (unsigned c) { @@ -491,7 +487,7 @@ public: /// \tparam Mapper unary function taking `Service&` and producing some result. /// \return Result vector of invoking `map` with each instance in parallel template >, typename return_type = decltype(internal::untuple(std::declval()))> - inline future> map(Mapper mapper) { + future> map(Mapper mapper) { return do_with(std::vector(), std::move(mapper), [this] (std::vector& vec, Mapper& mapper) mutable { vec.resize(_instances.size()); @@ -588,7 +584,6 @@ sharded::~sharded() { namespace internal { template -inline T&& unwrap_sharded_arg(T&& arg) { return std::forward(arg); @@ -706,20 +701,17 @@ struct sharded_call_stop { template <> template -inline future<> sharded_call_stop::call(Service& instance) { return instance.stop(); } template <> template -inline future<> sharded_call_stop::call(Service&) { return make_ready_future<>(); } template -inline future<> stop_sharded_instance(Service& instance) { constexpr bool has_stop = internal::sharded_has_stop::check(0); @@ -773,7 +765,6 @@ sharded::invoke_on_all(smp_submit_to_options options, std::function -inline future<> sharded::invoke_on_all(std::function (Service&)> func) noexcept { try { @@ -787,7 +778,6 @@ template template requires std::invocable...> && std::is_same_v...>>, future<>> -inline future<> sharded::invoke_on_all(smp_submit_to_options options, Func func, Args... args) noexcept { try { @@ -805,7 +795,6 @@ template template requires std::invocable...> && std::is_same_v...>>, future<>> -inline future<> sharded::invoke_on_all(Func func, Args... args) noexcept { try { @@ -819,7 +808,6 @@ template template requires std::invocable && std::is_same_v>, future<>> -inline future<> sharded::invoke_on_others(smp_submit_to_options options, Func func, Args... args) noexcept { try { @@ -835,7 +823,6 @@ template template requires std::invocable && std::is_same_v>, future<>> -inline future<> sharded::invoke_on_others(Func func, Args... args) noexcept { try { @@ -848,7 +835,6 @@ sharded::invoke_on_others(Func func, Args... args) noexcept { template template requires std::invocable -inline Ret sharded::invoke_on(unsigned id, smp_submit_to_options options, Func&& func, Args&&... args) { return smp::submit_to(id, options, [this, func = std::forward(func), args = std::tuple(std::move(args)...)] () mutable { @@ -860,7 +846,6 @@ sharded::invoke_on(unsigned id, smp_submit_to_options options, Func&& f template template requires std::invocable -inline Ret sharded::invoke_on(unsigned id, Func&& func, Args&&... args) { return invoke_on(id, smp_submit_to_options(), std::forward(func), std::forward(args)...); @@ -871,7 +856,6 @@ template requires std::invocable && std::is_same_v...>>, future<>> && internal::unsigned_range -inline future<> sharded::invoke_on(R range, smp_submit_to_options options, Func func, Args... args) noexcept { try { @@ -898,7 +882,6 @@ template requires std::invocable && std::is_same_v...>>, future<>> && internal::unsigned_range -inline future<> sharded::invoke_on(R range, Func func, Args... args) noexcept { try { @@ -927,7 +910,7 @@ shared_ptr sharded::local_shared() noexcept { } template -inline bool sharded::local_is_initialized() const noexcept { +bool sharded::local_is_initialized() const noexcept { return _instances.size() > this_shard_id() && _instances[this_shard_id()].service; }