]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: use map::merge() to merge maps
authorKefu Chai <kchai@redhat.com>
Fri, 7 May 2021 13:36:48 +0000 (21:36 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 7 May 2021 13:40:46 +0000 (21:40 +0800)
C++17's std::map allows us to merge two maps, and in this case, we can
even consume `child_result`. so map::merge() is used instead of insert()
in hope to avoid the memcpy and allocation of pair<> nodes.

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

index 4f5a7f6b5a0c650366392d442d187170d551354a..729c54b115b788cca930bbba3da306e72a7e0595 100644 (file)
@@ -232,10 +232,8 @@ OMapInnerNode::list(
              if (child_result.size() && start) {
                assert(child_result.begin()->first > *start);
              }
-             result.insert(
-               child_result.begin(),
-               child_result.end());
-             biter++;
+             result.merge(std::move(child_result));
+             ++biter;
              assert(child_complete || result.size() == config.max_result_size);
              return list_ertr::make_ready_future<bool>(false);
            });