]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: use create/destroy methods in RemoveRequest
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Tue, 14 Feb 2017 11:39:49 +0000 (19:39 +0800)
committerDongsheng Yang <dongsheng.yang@easystack.cn>
Thu, 23 Feb 2017 03:11:00 +0000 (11:11 +0800)
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
src/librbd/image/RemoveRequest.cc

index 98c0fef7cf6c8f3885acc38b2c6ef93805e9a273..24bc22beefe9fc81cdb12acc219c9e6f2f2e1cb0 100644 (file)
@@ -37,8 +37,8 @@ RemoveRequest<I>::RemoveRequest(IoCtx &ioctx, const std::string &image_name, con
   m_prog_ctx(prog_ctx), m_op_work_queue(op_work_queue), m_on_finish(on_finish) {
   m_cct = reinterpret_cast<CephContext *>(m_ioctx.cct());
 
-  m_image_ctx = new I((m_image_id.empty() ? m_image_name : std::string()),
-                      m_image_id, nullptr, m_ioctx, false);
+  m_image_ctx = I::create((m_image_id.empty() ? m_image_name : std::string()),
+                          m_image_id, nullptr, m_ioctx, false);
 }
 
 template<typename I>
@@ -448,7 +448,7 @@ template <typename I>
 void RemoveRequest<I>::handle_switch_thread_context(int r) {
   ldout(m_cct, 20) << ": r=" << r << dendl;
 
-  delete m_image_ctx;
+  m_image_ctx->destroy();
   m_image_ctx = nullptr;
 
   if (m_ret_val < 0 && m_ret_val != -ENOENT) {