]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds,osd: fix clang warnings to prevent unneeded copies 37557/head
authorWillem Jan Withagen <wjw@digiware.nl>
Mon, 5 Oct 2020 22:47:05 +0000 (00:47 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Tue, 6 Oct 2020 01:48:06 +0000 (03:48 +0200)
/home/jenkins/workspace/ceph-master-compile/src/osd/OSDMap.cc:3901:19: warning: loop variable 'pg' of type 'const std::__1::pair<const pg_t, int>' creates a copy from type 'const std::__1::pair<const pg_t, int>' [-Wrange-loop-construct]
  for (const auto pg : *primary_temp)
                  ^
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/mds/SimpleLock.h
src/osd/OSDMap.cc

index dd436790567996cfb00fb0f5e55be7a2d47353b5..5c625b6af06f2819b80bbd2df7984f038f1c3d34 100644 (file)
@@ -291,7 +291,7 @@ public:
   }
 
   void init_gather() {
-    for (const auto p : parent->get_replicas()) {
+    for (const auto& p : parent->get_replicas()) {
       more()->gather_set.insert(p.first);
     }
   }
index 196a6ea39b66f4ad2ad6459cd4018105b8c78cf4..7cafea2ad1bd4b5a24f80058779e969d595e69e6 100644 (file)
@@ -3898,7 +3898,7 @@ void OSDMap::print(ostream& out) const
   for (const auto& pg : *pg_temp)
     out << "pg_temp " << pg.first << " " << pg.second << "\n";
 
-  for (const auto pg : *primary_temp)
+  for (const auto& pg : *primary_temp)
     out << "primary_temp " << pg.first << " " << pg.second << "\n";
 
   for (const auto &addr : blocklist)