From d5da15259b37b7729d080133656d9c411d248017 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 1 May 2013 15:40:44 -0700 Subject: [PATCH] rgw: use shared_ptr instead of RefCountedObject Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_bucket.cc | 9 ++------- src/rgw/rgw_bucket.h | 7 +++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index e6f985c45e4cc..646176e1147ed 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1057,12 +1057,11 @@ int RGWDataChangesLog::choose_oid(rgw_bucket& bucket) { int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { lock.Lock(); - ChangeStatus *& status = changes[bucket.name]; + ChangeStatusPtr& status = changes[bucket.name]; if (!status) { - status = new ChangeStatus; + status = ChangeStatusPtr(new ChangeStatus); } - status->get(); lock.Unlock(); utime_t now = ceph_clock_now(cct); @@ -1073,7 +1072,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { if (now < status->cur_expiration) { /* no need to send, recently completed */ status->lock->Unlock(); - status->put(); return 0; } @@ -1086,7 +1084,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { status->cond->get(); status->lock->Unlock(); - status->put(); cond->wait(); cond->put(); @@ -1122,8 +1119,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) { status->cond = NULL; status->lock->Unlock(); - status->put(); - cond->done(); cond->put(); diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 7c4c3d3c6cb5e..b8492b54a3df5 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -2,6 +2,7 @@ #define CEPH_RGW_BUCKET_H #include +#include #include "include/types.h" #include "rgw_common.h" @@ -258,7 +259,7 @@ class RGWDataChangesLog { Mutex lock; - struct ChangeStatus : public RefCountedObject { + struct ChangeStatus { utime_t cur_expiration; utime_t cur_sent; bool pending; @@ -274,7 +275,9 @@ class RGWDataChangesLog { } }; - map changes; + typedef std::tr1::shared_ptr ChangeStatusPtr; + + map changes; public: -- 2.39.5