]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include: add detach method
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 12 Dec 2019 16:59:10 +0000 (08:59 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 16 Dec 2019 21:16:40 +0000 (13:16 -0800)
This makes the intent clear and avoids passing the output map to do the move.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/include/interval_set.h
src/os/bluestore/BlueStore.cc
src/osd/ReplicatedBackend.cc

index 6b6237d7cf7cdf4117efb3ac935d42009eb2f086..35c842b66b2bf1704e81c771d2d9ca7bdc6ba089 100644 (file)
@@ -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:
index feaf9da87a6fa776363607e2e0f2c16da8f7bb1f..d11eabf0ea0edc5c67c3c28ecb17a4057270d046 100644 (file)
@@ -9961,7 +9961,7 @@ int BlueStore::fiemap(
   interval_set<uint64_t> m;
   int r = _fiemap(c_, oid, offset, length, m);
   if (r >= 0) {
-    m.move_into(destmap);
+    destmap = std::move(m).detach();
   }
   return r;
 }
index 3c4190f577522aa9b8e30e388d79cff2fa138242..3a345107354f8359c3d8c5033c41560019fdceba 100644 (file)
@@ -264,7 +264,7 @@ int ReplicatedBackend::objects_readv_sync(
   interval_set<uint64_t> 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;
 }