]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OpRequest: use OpRequestRef for OpHistory
authorSamuel Just <sam.just@inktank.com>
Wed, 20 Mar 2013 18:49:03 +0000 (11:49 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 22 Mar 2013 01:37:35 +0000 (18:37 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OpRequest.cc
src/osd/OpRequest.h

index b3d95367ec595990ed4e8cb5367f02d2505bf7fb..2b44f16abebc335f88cfd2c4d775ec6f52002b76 100644 (file)
@@ -30,11 +30,11 @@ void OpHistory::insert(utime_t now, OpRequest *op)
 void OpHistory::cleanup(utime_t now)
 {
   while (arrived.size() &&
-        now - arrived.begin()->first > (double)(g_conf->osd_op_history_duration)) {
+        (now - arrived.begin()->first >
+         (double)(g_conf->osd_op_history_duration))) {
     duration.erase(make_pair(
        arrived.begin()->second->get_duration(),
        arrived.begin()->second));
-    delete arrived.begin()->second;
     arrived.erase(arrived.begin());
   }
 
@@ -42,7 +42,6 @@ void OpHistory::cleanup(utime_t now)
     arrived.erase(make_pair(
        duration.begin()->second->get_arrived(),
        duration.begin()->second));
-    delete duration.begin()->second;
     duration.erase(duration.begin());
   }
 }
@@ -55,7 +54,7 @@ void OpHistory::dump_ops(utime_t now, Formatter *f)
   f->dump_int("duration to keep", g_conf->osd_op_history_duration);
   {
     f->open_array_section("Ops");
-    for (set<pair<utime_t, const OpRequest *> >::const_iterator i =
+    for (set<pair<utime_t, OpRequestRef> >::const_iterator i =
           arrived.begin();
         i != arrived.end();
         ++i) {
index e12fbe00c53ddfa69e2c6452a481340ba4d341e3..65f4cc471ea000c128507191e71390b80515bcea 100644 (file)
 #include "osd/osd_types.h"
 
 class OpRequest;
+typedef std::tr1::shared_ptr<OpRequest> OpRequestRef;
 class OpHistory {
-  set<pair<utime_t, const OpRequest *> > arrived;
-  set<pair<double, const OpRequest *> > duration;
+  set<pair<utime_t, OpRequestRef> > arrived;
+  set<pair<double, OpRequestRef> > duration;
   void cleanup(utime_t now);
 
 public:
-  void insert(utime_t now, OpRequest *op);
+  void insert(utime_t now, OpRequestRef op);
   void dump_ops(utime_t now, Formatter *f);
 };
 
-class OpRequest;
-typedef std::tr1::shared_ptr<OpRequest> OpRequestRef;
 class OpTracker {
   class RemoveOnDelete {
     OpTracker *tracker;