From 7c53a69eaeec46ff45a7f9105b6a2a85f50be125 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 12 Dec 2019 10:44:50 -0800 Subject: [PATCH] include: codify the ownership change of the map Caller must explicitly std::move it. Signed-off-by: Patrick Donnelly --- src/include/interval_set.h | 2 +- src/osd/PGBackend.h | 2 +- src/osd/PrimaryLogPG.cc | 2 +- src/osd/ReplicatedBackend.cc | 6 +++--- src/osd/ReplicatedBackend.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/include/interval_set.h b/src/include/interval_set.h index 35c842b66b2b..3b7b0b82b7e3 100644 --- a/src/include/interval_set.h +++ b/src/include/interval_set.h @@ -160,7 +160,7 @@ class interval_set { }; interval_set() : _size(0) {} - interval_set(Map& other) { + interval_set(Map&& other) { m.swap(other); _size = 0; for (auto& i : m) { diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 513c62763352..67ce20118c11 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -565,7 +565,7 @@ typedef std::shared_ptr OSDMapRef; virtual int objects_readv_sync( const hobject_t &hoid, - map& m, + map&& m, uint32_t op_flags, bufferlist *bl) { return -EOPNOTSUPP; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 579b023914b2..bab42a1ab8cb 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5574,7 +5574,7 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) { } bufferlist data_bl; - r = pgbackend->objects_readv_sync(soid, m, op.flags, &data_bl); + r = pgbackend->objects_readv_sync(soid, std::move(m), op.flags, &data_bl); if (r == -EIO) { r = rep_repair_primary_object(soid, ctx); } diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 3a345107354f..ae06235a9c72 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -257,11 +257,11 @@ int ReplicatedBackend::objects_read_sync( int ReplicatedBackend::objects_readv_sync( const hobject_t &hoid, - map& m, + map&& m, uint32_t op_flags, bufferlist *bl) { - interval_set im(m); + interval_set im(std::move(m)); auto r = store->readv(ch, ghobject_t(hoid), im, *bl, op_flags); if (r >= 0) { m = std::move(im).detach(); @@ -2081,7 +2081,7 @@ int ReplicatedBackend::build_push_op(const ObjectRecoveryInfo &recovery_info, int r = store->fiemap(ch, ghobject_t(recovery_info.soid), 0, copy_subset.range_end(), m); if (r >= 0) { - interval_set fiemap_included(m); + interval_set fiemap_included(std::move(m)); copy_subset.intersection_of(fiemap_included); } else { // intersection of copy_subset and empty interval_set would be empty anyway diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index 4e272e492ee9..e6beffcc9164 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -151,7 +151,7 @@ public: int objects_readv_sync( const hobject_t &hoid, - map& m, + map&& m, uint32_t op_flags, bufferlist *bl) override; -- 2.47.3