From: Kefu Chai Date: Mon, 16 Aug 2021 12:05:47 +0000 (+0800) Subject: librbd: trade a raw pointer for unique_ptr<> X-Git-Tag: v17.1.0~1056^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8940c35c6c0ff157015da6c5ce901431261b7841;p=ceph.git librbd: trade a raw pointer for unique_ptr<> for better maintainablity Signed-off-by: Kefu Chai --- diff --git a/src/librbd/io/QosImageDispatch.cc b/src/librbd/io/QosImageDispatch.cc index ba7b37049851..51b9f399239f 100644 --- a/src/librbd/io/QosImageDispatch.cc +++ b/src/librbd/io/QosImageDispatch.cc @@ -68,7 +68,6 @@ QosImageDispatch::~QosImageDispatch() { for (auto t : m_throttles) { delete t.second; } - delete m_flush_tracker; } template diff --git a/src/librbd/io/QosImageDispatch.h b/src/librbd/io/QosImageDispatch.h index a1264cf828fe..885e2545ceaf 100644 --- a/src/librbd/io/QosImageDispatch.h +++ b/src/librbd/io/QosImageDispatch.h @@ -4,6 +4,9 @@ #ifndef CEPH_LIBRBD_IO_QOS_IMAGE_DISPATCH_H #define CEPH_LIBRBD_IO_QOS_IMAGE_DISPATCH_H +#include +#include + #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 struct Context; @@ -112,7 +114,7 @@ private: uint64_t m_qos_enabled_flag = 0; uint64_t m_qos_exclude_ops = 0; - FlushTracker* m_flush_tracker; + std::unique_ptr> m_flush_tracker; void handle_finished(int r, uint64_t tid);