]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds/FSMap.h: add const and reference
authorMichal Jarzabek <stiopa@gmail.com>
Sun, 6 Nov 2016 18:55:51 +0000 (18:55 +0000)
committerMichal Jarzabek <stiopa@gmail.com>
Sun, 6 Nov 2016 18:55:51 +0000 (18:55 +0000)
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/mds/FSMap.h

index a7a6533d8baf16a733863d5657070ccadd9eaf4f..fd6c359c75ccd8603d8ed8c419bc15e6a1127baf 100644 (file)
@@ -131,8 +131,8 @@ public:
       standby_daemons(rhs.standby_daemons),
       standby_epochs(rhs.standby_epochs)
   {
-    for (auto &i : rhs.filesystems) {
-      auto fs = i.second;
+    for (const auto &i : rhs.filesystems) {
+      const auto &fs = i.second;
       filesystems[fs->fscid] = std::make_shared<Filesystem>(*fs);
     }
   }
@@ -148,8 +148,8 @@ public:
     standby_daemons = rhs.standby_daemons;
     standby_epochs = rhs.standby_epochs;
 
-    for (auto &i : rhs.filesystems) {
-      auto fs = i.second;
+    for (const auto &i : rhs.filesystems) {
+      const auto &fs = i.second;
       filesystems[fs->fscid] = std::make_shared<Filesystem>(*fs);
     }
 
@@ -182,8 +182,8 @@ public:
     }
 
     for (const auto &i : filesystems) {
-      auto fs_info = i.second->mds_map.get_mds_info();
-      for (auto j : fs_info) {
+      const auto &fs_info = i.second->mds_map.get_mds_info();
+      for (const auto &j : fs_info) {
         result[j.first] = j.second;
       }
     }
@@ -319,7 +319,7 @@ public:
       assert(info.state == MDSMap::STATE_STANDBY);
       standby_epochs[who] = epoch;
     } else {
-      auto fs = filesystems[mds_roles.at(who)];
+      const auto &fs = filesystems[mds_roles.at(who)];
       auto &info = fs->mds_map.mds_info.at(who);
       fn(&info);
 
@@ -353,7 +353,7 @@ public:
     // but this is a lot simpler because it doesn't require us to
     // track the compat versions for standby daemons.
     compat = c;
-    for (auto i : filesystems) {
+    for (const auto &i : filesystems) {
       MDSMap &mds_map = i.second->mds_map;
       mds_map.compat = c;
       mds_map.epoch = epoch;
@@ -389,7 +389,7 @@ public:
   std::shared_ptr<const Filesystem> get_filesystem(void) const {return std::const_pointer_cast<const Filesystem>(filesystems.begin()->second);}
   std::shared_ptr<const Filesystem> get_filesystem(const std::string &name) const
   {
-    for (auto &i : filesystems) {
+    for (const auto &i : filesystems) {
       if (i.second->mds_map.fs_name == name) {
         return std::const_pointer_cast<const Filesystem>(i.second);
       }