From: Kefu Chai Date: Mon, 30 Oct 2017 06:48:43 +0000 (+0800) Subject: mds: pass a reference of function to sanitize() not a copy X-Git-Tag: v13.0.1~345^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18618%2Fhead;p=ceph.git 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 --- 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;