]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
TrackedOp: introduce a _dump_op_descriptor function
authorGreg Farnum <greg@inktank.com>
Tue, 22 Apr 2014 22:03:47 +0000 (15:03 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 5 May 2014 21:57:52 +0000 (14:57 -0700)
Use this instead of direct access to the Message underneath when dumping
the TrackedOp.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/common/TrackedOp.cc
src/common/TrackedOp.h
src/osd/OpRequest.cc
src/osd/OpRequest.h

index ddb2f91ac3f55980633c84a8615c842ba47b544f..65239ab2e05605f5a46cb99774b08f622399fce1 100644 (file)
@@ -264,9 +264,8 @@ void TrackedOp::mark_event(const string &event)
 
 void TrackedOp::dump(utime_t now, Formatter *f) const
 {
-  Message *m = request;
   stringstream name;
-  m->print(name);
+  _dump_op_descriptor(name);
   f->dump_string("description", name.str().c_str()); // this TrackedOp
   f->dump_stream("received_at") << get_arrived();
   f->dump_float("age", now - get_arrived());
index a2c092707c41a726a26d247f29756d4f63ab3f31..102d0bd50d9047a6e3d24fc576df20e8f019bcc7 100644 (file)
@@ -152,6 +152,8 @@ protected:
   virtual void _dump(utime_t now, Formatter *f) const {}
   /// if you want something else to happen when events are marked, implement
   virtual void _event_marked() {}
+  /// return a unique descriptor of the Op; eg the message it's attached to
+  virtual void _dump_op_descriptor(ostream& stream) const = 0;
 
 public:
   virtual ~TrackedOp() { assert(request); request->put(); }
index a42a085ebd0eadc7eb23df11c41bd88835993e95..949071a03512f5eebc4e7fd80792d9fee38c2997 100644 (file)
@@ -55,6 +55,11 @@ void OpRequest::_dump(utime_t now, Formatter *f) const
   }
 }
 
+void OpRequest::_dump_op_descriptor(ostream& stream) const
+{
+  get_req()->print(stream);
+}
+
 bool OpRequest::check_rmw(int flag) {
   return rmw_flags & flag;
 }
index 931f4aebbbe9af9e9ad3cf44a93ef5b7d2e47a8d..ba6333fd4974c8ef039d7b27c871061099ebfca2 100644 (file)
@@ -88,6 +88,9 @@ private:
 
   OpRequest(Message *req, OpTracker *tracker);
 
+protected:
+  void _dump_op_descriptor(ostream& stream) const;
+
 public:
   bool been_queued_for_pg() { return hit_flag_points & flag_queued_for_pg; }
   bool been_reached_pg() { return hit_flag_points & flag_reached_pg; }