]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: trade a raw pointer for unique_ptr<>
authorKefu Chai <kchai@redhat.com>
Mon, 16 Aug 2021 12:05:47 +0000 (20:05 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 16 Aug 2021 12:09:33 +0000 (20:09 +0800)
for better maintainablity

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/librbd/io/QosImageDispatch.cc
src/librbd/io/QosImageDispatch.h

index ba7b37049851151778de42cc5a7b7bfa14526f58..51b9f399239f075e4c1744be9719a0d581ea74c7 100644 (file)
@@ -68,7 +68,6 @@ QosImageDispatch<I>::~QosImageDispatch() {
   for (auto t : m_throttles) {
     delete t.second;
   }
-  delete m_flush_tracker;
 }
 
 template <typename I>
index a1264cf828fe86ef72d105b59101fb3d9a775cbf..885e2545ceafe3398ed6198850e098d9b4bc2c46 100644 (file)
@@ -4,6 +4,9 @@
 #ifndef CEPH_LIBRBD_IO_QOS_IMAGE_DISPATCH_H
 #define CEPH_LIBRBD_IO_QOS_IMAGE_DISPATCH_H
 
+#include <list>
+#include <memory>
+
 #include "librbd/io/ImageDispatchInterface.h"
 #include "include/int_types.h"
 #include "include/buffer.h"
@@ -11,7 +14,6 @@
 #include "common/Throttle.h"
 #include "librbd/io/ReadResult.h"
 #include "librbd/io/Types.h"
-#include <list>
 
 struct Context;
 
@@ -112,7 +114,7 @@ private:
   uint64_t m_qos_enabled_flag = 0;
   uint64_t m_qos_exclude_ops = 0;
 
-  FlushTracker<ImageCtxT>* m_flush_tracker;
+  std::unique_ptr<FlushTracker<ImageCtxT>> m_flush_tracker;
 
   void handle_finished(int r, uint64_t tid);