From 000a9f622fcb5cadb29d28d5ce32ea34f2a0d49b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 30 May 2017 15:38:04 -0400 Subject: [PATCH] mon/mon_types: move C_MonOp to MonOpRequest.h Fixes a circular #include of mon_types -> MonOpRequest -> Session -> mon_types Signed-off-by: Sage Weil --- src/mon/MonOpRequest.h | 26 ++++++++++++++++++++++++++ src/mon/mon_types.h | 27 --------------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/mon/MonOpRequest.h b/src/mon/MonOpRequest.h index bd85f11f683..a5000efe44e 100644 --- a/src/mon/MonOpRequest.h +++ b/src/mon/MonOpRequest.h @@ -218,4 +218,30 @@ public: typedef MonOpRequest::Ref MonOpRequestRef; +struct C_MonOp : public Context +{ + MonOpRequestRef op; + + explicit C_MonOp(MonOpRequestRef o) : + op(o) { } + + void finish(int r) override { + if (op && r == -ECANCELED) { + op->mark_event("callback canceled"); + } else if (op && r == -EAGAIN) { + op->mark_event("callback retry"); + } else if (op && r == 0) { + op->mark_event("callback finished"); + } + _finish(r); + } + + void mark_op_event(const string &event) { + if (op) + op->mark_event_string(event); + } + + virtual void _finish(int r) = 0; +}; + #endif /* MON_OPREQUEST_H_ */ diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index c34e87268f9..54bbfb336d0 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -20,7 +20,6 @@ #include "common/Formatter.h" #include "common/bit_str.h" #include "include/Context.h" -#include "mon/MonOpRequest.h" #define PAXOS_PGMAP 0 // before osd, for pg kick to behave #define PAXOS_MDSMAP 1 @@ -211,32 +210,6 @@ static inline ostream& operator<<(ostream& out, const ScrubResult& r) { /// for information like os, kernel, hostname, memory info, cpu model. typedef map Metadata; -struct C_MonOp : public Context -{ - MonOpRequestRef op; - - explicit C_MonOp(MonOpRequestRef o) : - op(o) { } - - void finish(int r) override { - if (op && r == -ECANCELED) { - op->mark_event("callback canceled"); - } else if (op && r == -EAGAIN) { - op->mark_event("callback retry"); - } else if (op && r == 0) { - op->mark_event("callback finished"); - } - _finish(r); - } - - void mark_op_event(const string &event) { - if (op) - op->mark_event_string(event); - } - - virtual void _finish(int r) = 0; -}; - namespace ceph { namespace features { namespace mon { -- 2.47.3