From b3d49f88eab625e1f6145e500003108e1abbe8d1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 30 Oct 2017 14:48:43 +0800 Subject: [PATCH] mds: pass a reference of function to sanitize() not a copy to save the overhead of creating and destoying a copy of the function closure. Signed-off-by: Kefu Chai --- src/mds/FSMap.cc | 2 +- src/mds/FSMap.h | 2 +- src/mds/MDSMap.cc | 2 +- src/mds/MDSMap.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index b224e11190d2..e346cf623f75 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -621,7 +621,7 @@ void FSMap::decode(bufferlist::iterator& p) DECODE_FINISH(p); } -void FSMap::sanitize(std::function pool_exists) +void FSMap::sanitize(const std::function& pool_exists) { for (auto &fs : filesystems) { fs.second->mds_map.sanitize(pool_exists); diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h index 3bb97ee58aae..f89cfb2b8139 100644 --- a/src/mds/FSMap.h +++ b/src/mds/FSMap.h @@ -493,7 +493,7 @@ public: bufferlist::iterator p = bl.begin(); decode(p); } - void sanitize(std::function pool_exists); + void sanitize(const std::function& pool_exists); void print(ostream& out) const; void print_summary(Formatter *f, ostream *out) const; diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index 9dfce950f5a8..ea154ff18bb9 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -637,7 +637,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void MDSMap::sanitize(std::function pool_exists) +void MDSMap::sanitize(const std::function& pool_exists) { /* Before we did stricter checking, it was possible to remove a data pool * without also deleting it from the MDSMap. Check for that here after diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index 454f422dde22..38be4d4bae9e 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -660,7 +660,7 @@ public: bufferlist::iterator p = bl.begin(); decode(p); } - void sanitize(std::function pool_exists); + void sanitize(const std::function& pool_exists); void print(ostream& out) const; void print_summary(Formatter *f, ostream *out) const; -- 2.47.3