From: Patrick Donnelly Date: Thu, 12 Dec 2019 16:59:10 +0000 (-0800) Subject: include: add detach method X-Git-Tag: v15.1.0~380^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=817cc50faca45cf0a9b12983545b2e251c697ea7;p=ceph.git include: add detach method This makes the intent clear and avoids passing the output map to do the move. Signed-off-by: Patrick Donnelly --- diff --git a/src/include/interval_set.h b/src/include/interval_set.h index 6b6237d7cf7c..35c842b66b2b 100644 --- a/src/include/interval_set.h +++ b/src/include/interval_set.h @@ -720,8 +720,8 @@ class interval_set { * Move contents of m into another Map. Use that instead of * encoding interval_set into bufferlist then decoding it back into Map. */ - void move_into(Map& other) { - other = std::move(m); + Map detach() && { + return std::move(m); } private: diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index feaf9da87a6f..d11eabf0ea0e 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -9961,7 +9961,7 @@ int BlueStore::fiemap( interval_set m; int r = _fiemap(c_, oid, offset, length, m); if (r >= 0) { - m.move_into(destmap); + destmap = std::move(m).detach(); } return r; } diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 3c4190f57752..3a345107354f 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -264,7 +264,7 @@ int ReplicatedBackend::objects_readv_sync( interval_set im(m); auto r = store->readv(ch, ghobject_t(hoid), im, *bl, op_flags); if (r >= 0) { - im.move_into(m); + m = std::move(im).detach(); } return r; }