]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD.h: move shared_ptr instead of copying it 8986/head
authorMichal Jarzabek <stiopa@gmail.com>
Wed, 4 May 2016 21:39:26 +0000 (22:39 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Wed, 4 May 2016 21:39:26 +0000 (22:39 +0100)
By copying map to next_osdmap we are increasing the shared_ptr's
reference count, which is then decreased again when map variable goes
out of scope. This can be avoided by using std move.

Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/osd/OSD.h

index 1ec1bd487bc89d6f2a72906c66e16fdc095d7e02..46dd384514e49c738746c6ce65ae5d83441b69ca 100644 (file)
@@ -505,7 +505,7 @@ public:
   Cond pre_publish_cond;
   void pre_publish_map(OSDMapRef map) {
     Mutex::Locker l(pre_publish_lock);
-    next_osdmap = map;
+    next_osdmap = std::move(map);
   }
 
   void activate_map();