From: Yehuda Sadeh Date: Wed, 1 May 2013 22:40:44 +0000 (-0700) Subject: rgw: use shared_ptr instead of RefCountedObject X-Git-Tag: v0.67-rc1~128^2~146 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d5da15259b37b7729d080133656d9c411d248017;p=ceph.git rgw: use shared_ptr instead of RefCountedObject Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index e6f985c45e4..646176e1147 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 7c4c3d3c6cb..b8492b54a3d 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: