]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: use reference for loop variable 41885/head
authorKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 11:58:42 +0000 (19:58 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 11:58:50 +0000 (19:58 +0800)
for better performance, also silences the warning like:

../src/crimson/os/seastore/random_block_manager/nvme_manager.cc:444:23: warning: loop variable ‘b’ creates a copy from type ‘const crimson::os::seastore::rbm_alloc_delta_t’ [-Wrange-loop-construct]
  444 |       for (const auto b : alloc_blocks) {
      |                       ^

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/seastore/random_block_manager/nvme_manager.cc

index 989c7864b2f7b31b1cf4cf533a792e74d450a94d..8326162b8662031490e48e04f10587573bc10698 100644 (file)
@@ -441,7 +441,7 @@ NVMeManager::write_ertr::future<> NVMeManager::sync_allocation(
       });
     }).safe_then([this, &alloc_blocks]() mutable {
       int alloc_block_count = 0;
-      for (const auto b : alloc_blocks) {
+      for (const auto& b : alloc_blocks) {
        for (interval_set<blk_id_t>::const_iterator r = b.alloc_blk_ids.begin();
             r != b.alloc_blk_ids.end(); ++r) {
          if (b.op == rbm_alloc_delta_t::op_types_t::SET) {