Skip to content

Commit

Permalink
include: codify the ownership change of the map
Browse files Browse the repository at this point in the history
Caller must explicitly std::move it.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Dec 16, 2019
1 parent 817cc50 commit 7c53a69
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/include/interval_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/osd/PGBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;

virtual int objects_readv_sync(
const hobject_t &hoid,
map<uint64_t, uint64_t>& m,
map<uint64_t, uint64_t>&& m,
uint32_t op_flags,
bufferlist *bl) {
return -EOPNOTSUPP;
Expand Down
2 changes: 1 addition & 1 deletion src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/osd/ReplicatedBackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ int ReplicatedBackend::objects_read_sync(

int ReplicatedBackend::objects_readv_sync(
const hobject_t &hoid,
map<uint64_t, uint64_t>& m,
map<uint64_t, uint64_t>&& m,
uint32_t op_flags,
bufferlist *bl)
{
interval_set<uint64_t> im(m);
interval_set<uint64_t> im(std::move(m));
auto r = store->readv(ch, ghobject_t(hoid), im, *bl, op_flags);
if (r >= 0) {
m = std::move(im).detach();
Expand Down Expand Up @@ -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<uint64_t> fiemap_included(m);
interval_set<uint64_t> fiemap_included(std::move(m));
copy_subset.intersection_of(fiemap_included);
} else {
// intersection of copy_subset and empty interval_set would be empty anyway
Expand Down
2 changes: 1 addition & 1 deletion src/osd/ReplicatedBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ReplicatedBackend : public PGBackend {

int objects_readv_sync(
const hobject_t &hoid,
map<uint64_t, uint64_t>& m,
map<uint64_t, uint64_t>&& m,
uint32_t op_flags,
bufferlist *bl) override;

Expand Down

0 comments on commit 7c53a69

Please sign in to comment.