]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: use reference when structured binding
authorKefu Chai <tchaikov@gmail.com>
Tue, 1 Mar 2022 14:38:49 +0000 (22:38 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 1 Mar 2022 16:31:14 +0000 (00:31 +0800)
to silence warning from clang13 with -std=c++20, like

ceph/src/crimson/osd/replicated_recovery_backend.cc:1098:21: warning: loop variable '[off, len]' creates a copy from type 'const std::pair<const unsigned long, unsigned long>' [-Wrange-loop-construct]
    for (const auto [off, len] : extents) {
                    ^
ceph/src/crimson/osd/replicated_recovery_backend.cc:1098:10: note: use reference type 'const std::pair<const unsigned long, unsigned long> &' to prevent copying
    for (const auto [off, len] : extents) {
         ^~~~~~~~~~~~~~~~~~~~~~~
                    &

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/osd/replicated_recovery_backend.cc

index dae4c8ef853f85980faa674233f2ae3fb7b5f2f0..12b660a4d7d6691f88e12fb09a9a6ecc8819fc21 100644 (file)
@@ -1095,7 +1095,7 @@ void ReplicatedRecoveryBackend::submit_push_complete(
   ObjectStore::Transaction *t)
 {
   for (const auto& [oid, extents] : recovery_info.clone_subset) {
-    for (const auto [off, len] : extents) {
+    for (const auto& [off, len] : extents) {
       logger().debug(" clone_range {} {}~{}", oid, off, len);
       t->clone_range(coll->get_cid(), ghobject_t(oid), ghobject_t(recovery_info.soid),
                      off, len, off);