]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: pass a reference of function to sanitize() not a copy 18618/head
authorKefu Chai <kchai@redhat.com>
Mon, 30 Oct 2017 06:48:43 +0000 (14:48 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 30 Oct 2017 06:51:59 +0000 (14:51 +0800)
to save the overhead of creating and destoying a copy of the function
closure.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mds/FSMap.cc
src/mds/FSMap.h
src/mds/MDSMap.cc
src/mds/MDSMap.h

index b224e11190d25c9e9edd17e8c36c1a95bfd7fb0a..e346cf623f75fd045463038d2d7e104edd40289e 100644 (file)
@@ -621,7 +621,7 @@ void FSMap::decode(bufferlist::iterator& p)
   DECODE_FINISH(p);
 }
 
-void FSMap::sanitize(std::function<bool(int64_t pool)> pool_exists)
+void FSMap::sanitize(const std::function<bool(int64_t pool)>& pool_exists)
 {
   for (auto &fs : filesystems) {
     fs.second->mds_map.sanitize(pool_exists);
index 3bb97ee58aae94f737097844671a3e71cecd7286..f89cfb2b813914b5c2a31e0f781fd848458041ed 100644 (file)
@@ -493,7 +493,7 @@ public:
     bufferlist::iterator p = bl.begin();
     decode(p);
   }
-  void sanitize(std::function<bool(int64_t pool)> pool_exists);
+  void sanitize(const std::function<bool(int64_t pool)>& pool_exists);
 
   void print(ostream& out) const;
   void print_summary(Formatter *f, ostream *out) const;
index 9dfce950f5a8d46fa2d410b198122e0d965e11c5..ea154ff18bb9be6a2596f95ded191c7f6af50c70 100644 (file)
@@ -637,7 +637,7 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const
   ENCODE_FINISH(bl);
 }
 
-void MDSMap::sanitize(std::function<bool(int64_t pool)> pool_exists)
+void MDSMap::sanitize(const std::function<bool(int64_t pool)>& 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
index 454f422dde2288ee1ae4c70e1912f0ffab49bc03..38be4d4bae9e68e2116fbcdddd1c4b954d6a380f 100644 (file)
@@ -660,7 +660,7 @@ public:
     bufferlist::iterator p = bl.begin();
     decode(p);
   }
-  void sanitize(std::function<bool(int64_t pool)> pool_exists);
+  void sanitize(const std::function<bool(int64_t pool)>& pool_exists);
 
   void print(ostream& out) const;
   void print_summary(Formatter *f, ostream *out) const;