summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-03-26 13:11:21 -0700
committerGreg Farnum <greg@inktank.com>2013-09-19 18:14:59 -0700
commit5fdaccd2d7fdceef402ec2536eff3992f6b28833 (patch)
tree5f885a6dfdf9abc7b8b373aa794749a1597ef5e4
parent24c33896f9b43e37a014d8dc31045af5ea79a792 (diff)
downloadceph-5fdaccd2d7fdceef402ec2536eff3992f6b28833.tar.gz
OpTracker: add an init_from_message() to the TrackedOp interface
This can be used for the concrete implementations to gather any extra data out of the message and do whatever extra setup based on that they want. The OpTracker will call this after doing all its internal setup but before anybody else gets to see the TrackedOp. Signed-off-by: Greg Farnum <greg@inktank.com>
-rw-r--r--src/common/TrackedOp.h2
-rw-r--r--src/osd/OpRequest.cc9
-rw-r--r--src/osd/OpRequest.h13
3 files changed, 16 insertions, 8 deletions
diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h
index 835cf86e9d3..7a7b66396f6 100644
--- a/src/common/TrackedOp.h
+++ b/src/common/TrackedOp.h
@@ -42,6 +42,8 @@ public:
warn_interval_multiplier(1),
seq(0) {}
+ virtual void init_from_message() {};
+
virtual ~TrackedOp() {}
utime_t get_arrived() const {
diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc
index 388faf36763..5a9abd63cf6 100644
--- a/src/osd/OpRequest.cc
+++ b/src/osd/OpRequest.cc
@@ -285,3 +285,12 @@ void OpRequest::mark_event(const string &event)
}
tracker->mark_event(this, event);
}
+
+void OpRequest::init_from_message()
+{
+ if (request->get_type() == CEPH_MSG_OSD_OP) {
+ reqid = static_cast<MOSDOp*>(request)->get_reqid();
+ } else if (request->get_type() == MSG_OSD_SUBOP) {
+ reqid = static_cast<MOSDSubOp*>(request)->reqid;
+ }
+}
diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h
index f501c649699..7dc8e78afa5 100644
--- a/src/osd/OpRequest.h
+++ b/src/osd/OpRequest.h
@@ -25,9 +25,6 @@
#include <tr1/memory>
#include "common/TrackedOp.h"
#include "osd/osd_types.h"
-// FIXME: augh, get these outta here!
-#include "messages/MOSDOp.h"
-#include "messages/MOSDSubOp.h"
class OpTracker;
class OpHistory {
@@ -101,15 +98,13 @@ public:
TRef retval(new T(ref, this),
RemoveOnDelete(this));
- if (ref->get_type() == CEPH_MSG_OSD_OP) {
- retval->reqid = static_cast<MOSDOp*>(ref)->get_reqid();
- } else if (ref->get_type() == MSG_OSD_SUBOP) {
- retval->reqid = static_cast<MOSDSubOp*>(ref)->reqid;
- }
_mark_event(retval.get(), "header_read", ref->get_recv_stamp());
_mark_event(retval.get(), "throttled", ref->get_throttle_stamp());
_mark_event(retval.get(), "all_read", ref->get_recv_complete_stamp());
_mark_event(retval.get(), "dispatched", ref->get_dispatch_stamp());
+
+ retval->init_from_message();
+
return retval;
}
};
@@ -238,6 +233,8 @@ public:
osd_reqid_t get_reqid() const {
return reqid;
}
+
+ void init_from_message();
};
typedef std::tr1::shared_ptr<OpRequest> OpRequestRef;