From 0faae7e8909c94691817ef9b2cfac2dcb38d3029 Mon Sep 17 00:00:00 2001 From: "lu.shasha" Date: Tue, 11 Jul 2017 11:20:15 +0800 Subject: [PATCH] rgw:multisite: change raw 'RGWAioCompletionNotifier*' to intrusive_ptr for rgw_cr_rados Signed-off-by: Shasha Lu --- src/rgw/rgw_cr_rados.cc | 32 -------------------------------- src/rgw/rgw_cr_rados.h | 16 ++++------------ 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index cd83d8aa0b6..107d605158c 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -220,13 +220,6 @@ RGWRadosSetOmapKeysCR::RGWRadosSetOmapKeysCR(RGWRados *_store, s << "]"; } -RGWRadosSetOmapKeysCR::~RGWRadosSetOmapKeysCR() -{ - if (cn) { - cn->put(); - } -} - int RGWRadosSetOmapKeysCR::send_request() { int r = store->get_raw_obj_ref(obj, &ref); @@ -241,7 +234,6 @@ int RGWRadosSetOmapKeysCR::send_request() op.omap_set(entries); cn = stack->create_completion_notifier(); - cn->get(); return ref.ioctx.aio_operate(ref.oid, cn->completion(), &op); } @@ -266,10 +258,6 @@ RGWRadosGetOmapKeysCR::RGWRadosGetOmapKeysCR(RGWRados *_store, set_description() << "set omap keys dest=" << obj << " marker=" << marker; } -RGWRadosGetOmapKeysCR::~RGWRadosGetOmapKeysCR() -{ -} - int RGWRadosGetOmapKeysCR::send_request() { int r = store->get_raw_obj_ref(obj, &ref); if (r < 0) { @@ -296,10 +284,6 @@ RGWRadosRemoveOmapKeysCR::RGWRadosRemoveOmapKeysCR(RGWRados *_store, set_description() << "remove omap keys dest=" << obj << " keys=" << keys; } -RGWRadosRemoveOmapKeysCR::~RGWRadosRemoveOmapKeysCR() -{ -} - int RGWRadosRemoveOmapKeysCR::send_request() { int r = store->get_raw_obj_ref(obj, &ref); if (r < 0) { @@ -701,19 +685,11 @@ RGWRadosTimelogAddCR::RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid, entries.push_back(entry); } -RGWRadosTimelogAddCR::~RGWRadosTimelogAddCR() -{ - if (cn) { - cn->put(); - } -} - int RGWRadosTimelogAddCR::send_request() { set_status() << "sending request"; cn = stack->create_completion_notifier(); - cn->get(); return store->time_log_add(oid, entries, cn->completion(), true); } @@ -741,19 +717,11 @@ RGWRadosTimelogTrimCR::RGWRadosTimelogTrimCR(RGWRados *store, << " from_marker=" << from_marker << " to_marker=" << to_marker; } -RGWRadosTimelogTrimCR::~RGWRadosTimelogTrimCR() -{ - if (cn) { - cn->put(); - } -} - int RGWRadosTimelogTrimCR::send_request() { set_status() << "sending request"; cn = stack->create_completion_notifier(); - cn->get(); return store->time_log_trim(oid, start_time, end_time, from_marker, to_marker, cn->completion()); } diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 100e200b8ea..faa179f8627 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -396,15 +396,13 @@ class RGWRadosSetOmapKeysCR : public RGWSimpleCoroutine { rgw_raw_obj obj; - RGWAioCompletionNotifier *cn; + boost::intrusive_ptr cn; public: RGWRadosSetOmapKeysCR(RGWRados *_store, const rgw_raw_obj& _obj, map& _entries); - ~RGWRadosSetOmapKeysCR() override; - int send_request() override; int request_complete() override; }; @@ -421,7 +419,7 @@ class RGWRadosGetOmapKeysCR : public RGWSimpleCoroutine { rgw_raw_obj obj; - RGWAioCompletionNotifier *cn; + boost::intrusive_ptr cn; public: RGWRadosGetOmapKeysCR(RGWRados *_store, @@ -429,8 +427,6 @@ public: const string& _marker, map *_entries, int _max_entries); - ~RGWRadosGetOmapKeysCR() override; - int send_request() override; int request_complete() override { @@ -454,8 +450,6 @@ public: const rgw_raw_obj& _obj, const set& _keys); - ~RGWRadosRemoveOmapKeysCR() override; - int send_request() override; int request_complete() override; @@ -1078,12 +1072,11 @@ class RGWRadosTimelogAddCR : public RGWSimpleCoroutine { string oid; - RGWAioCompletionNotifier *cn; + boost::intrusive_ptr cn; public: RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid, const cls_log_entry& entry); - ~RGWRadosTimelogAddCR() override; int send_request() override; int request_complete() override; @@ -1091,7 +1084,7 @@ public: class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine { RGWRados *store; - RGWAioCompletionNotifier *cn{nullptr}; + boost::intrusive_ptr cn; protected: std::string oid; real_time start_time; @@ -1104,7 +1097,6 @@ class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine { const real_time& start_time, const real_time& end_time, const std::string& from_marker, const std::string& to_marker); - ~RGWRadosTimelogTrimCR() override; int send_request() override; int request_complete() override; -- 2.39.5