summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-05-01 15:40:44 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-05-01 15:40:44 -0700
commitcdff01d6c47d9a235d7866d9e69698333174738f (patch)
tree2ff0b595760b4dcab19202fb1e7208c78cb0043b
parent7c56039aebc4f21a6498cdb2f3ccdcc3319ed292 (diff)
downloadceph-cdff01d6c47d9a235d7866d9e69698333174738f.tar.gz
rgw: use shared_ptr instead of RefCountedObject
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_bucket.cc9
-rw-r--r--src/rgw/rgw_bucket.h7
2 files changed, 7 insertions, 9 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc
index 13920e9e87f..da47fa76a3e 100644
--- a/src/rgw/rgw_bucket.cc
+++ b/src/rgw/rgw_bucket.cc
@@ -1096,12 +1096,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);
@@ -1112,7 +1111,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;
}
@@ -1125,7 +1123,6 @@ int RGWDataChangesLog::add_entry(rgw_bucket& bucket) {
status->cond->get();
status->lock->Unlock();
- status->put();
cond->wait();
cond->put();
@@ -1161,8 +1158,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 2ac0144409c..7a715459d3d 100644
--- a/src/rgw/rgw_bucket.h
+++ b/src/rgw/rgw_bucket.h
@@ -2,6 +2,7 @@
#define CEPH_RGW_BUCKET_H
#include <string>
+#include <memory>
#include "include/types.h"
#include "rgw_common.h"
@@ -261,7 +262,7 @@ class RGWDataChangesLog {
Mutex lock;
- struct ChangeStatus : public RefCountedObject {
+ struct ChangeStatus {
utime_t cur_expiration;
utime_t cur_sent;
bool pending;
@@ -277,7 +278,9 @@ class RGWDataChangesLog {
}
};
- map<string, ChangeStatus *> changes;
+ typedef std::tr1::shared_ptr<ChangeStatus> ChangeStatusPtr;
+
+ map<string, ChangeStatusPtr> changes;
public: