From: Radoslaw Zarzynski Date: Sun, 4 Feb 2018 04:45:43 +0000 (+0100) Subject: os/bluestore: avoid overhead of std::function in blob_t. X-Git-Tag: v13.0.2~304^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20294%2Fhead;p=ceph.git os/bluestore: avoid overhead of std::function in blob_t. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 604360c03c4a..ece69413b195 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -17,6 +17,7 @@ #include #include +#include #include "include/types.h" #include "include/interval_set.h" #include "include/utime.h" @@ -730,8 +731,10 @@ public: } } - int map(uint64_t x_off, uint64_t x_len, - std::function f) const { + template + int map(uint64_t x_off, uint64_t x_len, F&& f) const { + static_assert(std::is_invocable_r_v); + auto p = extents.begin(); assert(p != extents.end()); while (x_off >= p->length) { @@ -751,9 +754,12 @@ public: } return 0; } + template void map_bl(uint64_t x_off, bufferlist& bl, - std::function f) const { + F&& f) const { + static_assert(std::is_invocable_v); + auto p = extents.begin(); assert(p != extents.end()); while (x_off >= p->length) {