From: Sage Weil Date: Mon, 6 Feb 2017 22:39:58 +0000 (-0500) Subject: osd: make all fast dispatch ops MOSDFastDispatchOp children X-Git-Tag: v12.0.1~383^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=baa56a65340213fe08c99c59fba8ce730552d0c6;p=ceph.git osd: make all fast dispatch ops MOSDFastDispatchOp children Define common get_spg() and get_map_epoch() methods. Signed-off-by: Sage Weil --- diff --git a/src/messages/MOSDECSubOpRead.h b/src/messages/MOSDECSubOpRead.h index 3e315ef26a8e..5199d32a27ed 100644 --- a/src/messages/MOSDECSubOpRead.h +++ b/src/messages/MOSDECSubOpRead.h @@ -15,11 +15,10 @@ #ifndef MOSDECSUBOPREAD_H #define MOSDECSUBOPREAD_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpRead : public Message { +class MOSDECSubOpRead : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; @@ -31,9 +30,15 @@ public: int get_cost() const { return 0; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } - MOSDECSubOpRead() : - Message(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION) + MOSDECSubOpRead() + : MOSDFastDispatchOp(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION) {} virtual void decode_payload() { diff --git a/src/messages/MOSDECSubOpReadReply.h b/src/messages/MOSDECSubOpReadReply.h index 28e2cf7e9291..7d6512c8dd54 100644 --- a/src/messages/MOSDECSubOpReadReply.h +++ b/src/messages/MOSDECSubOpReadReply.h @@ -15,11 +15,10 @@ #ifndef MOSDECSUBOPREADREPLY_H #define MOSDECSUBOPREADREPLY_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpReadReply : public Message { +class MOSDECSubOpReadReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -31,9 +30,15 @@ public: int get_cost() const { return 0; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } - MOSDECSubOpReadReply() : - Message(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION) + MOSDECSubOpReadReply() + : MOSDFastDispatchOp(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION) {} virtual void decode_payload() { diff --git a/src/messages/MOSDECSubOpWrite.h b/src/messages/MOSDECSubOpWrite.h index b3a8e3cdb1f2..24b9a4e41205 100644 --- a/src/messages/MOSDECSubOpWrite.h +++ b/src/messages/MOSDECSubOpWrite.h @@ -15,11 +15,10 @@ #ifndef MOSDECSUBOPWRITE_H #define MOSDECSUBOPWRITE_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpWrite : public Message { +class MOSDECSubOpWrite : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -31,12 +30,18 @@ public: int get_cost() const { return 0; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } MOSDECSubOpWrite() - : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) + : MOSDFastDispatchOp(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) {} MOSDECSubOpWrite(ECSubWrite &in_op) - : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) { + : MOSDFastDispatchOp(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) { op.claim(in_op); } diff --git a/src/messages/MOSDECSubOpWriteReply.h b/src/messages/MOSDECSubOpWriteReply.h index c2edfb38c3e8..4a811cdf7a56 100644 --- a/src/messages/MOSDECSubOpWriteReply.h +++ b/src/messages/MOSDECSubOpWriteReply.h @@ -15,11 +15,10 @@ #ifndef MOSDECSUBOPWRITEREPLY_H #define MOSDECSUBOPWRITEREPLY_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpWriteReply : public Message { +class MOSDECSubOpWriteReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -31,9 +30,15 @@ public: int get_cost() const { return 0; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } - MOSDECSubOpWriteReply() : - Message(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION) + MOSDECSubOpWriteReply() + : MOSDFastDispatchOp(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION) {} virtual void decode_payload() { diff --git a/src/messages/MOSDFastDispatchOp.h b/src/messages/MOSDFastDispatchOp.h new file mode 100644 index 000000000000..6babd16f7961 --- /dev/null +++ b/src/messages/MOSDFastDispatchOp.h @@ -0,0 +1,19 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_MOSDFASTDISPATCHOP_H +#define CEPH_MOSDFASTDISPATCHOP_H + +#include "msg/Message.h" +#include "osd/osd_types.h" + +class MOSDFastDispatchOp : public Message { +public: + virtual epoch_t get_map_epoch() const = 0; + virtual spg_t get_spg() const = 0; + + MOSDFastDispatchOp(int t, int version, int compat_version) + : Message(t, version, compat_version) {} +}; + +#endif diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index 75af1d747ad4..5c2db7b011b4 100755 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -16,8 +16,7 @@ #ifndef CEPH_MOSDOP_H #define CEPH_MOSDOP_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "include/ceph_features.h" #include "common/hobject.h" #include @@ -32,7 +31,7 @@ class OSD; -class MOSDOp : public Message { +class MOSDOp : public MOSDFastDispatchOp { static const int HEAD_VERSION = 8; static const int COMPAT_VERSION = 3; @@ -86,7 +85,7 @@ public: assert(!partial_decode_needed); return pgid.pgid; } - spg_t get_spg() const { + spg_t get_spg() const override { assert(!partial_decode_needed); return pgid; } @@ -94,7 +93,7 @@ public: assert(!partial_decode_needed); return pg_t(hobj.get_hash(), pgid.pgid.pool()); } - epoch_t get_map_epoch() const { + epoch_t get_map_epoch() const override { assert(!partial_decode_needed); return osdmap_epoch; } @@ -168,13 +167,13 @@ public: } MOSDOp() - : Message(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), partial_decode_needed(true), final_decode_needed(true) { } MOSDOp(int inc, long tid, const hobject_t& ho, spg_t& _pgid, epoch_t _osdmap_epoch, int _flags, uint64_t feat) - : Message(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), client_inc(inc), osdmap_epoch(_osdmap_epoch), flags(_flags), retry_attempt(-1), hobj(ho), diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index d4b65e82c298..3b099df5aadb 100644 --- a/src/messages/MOSDPGBackfill.h +++ b/src/messages/MOSDPGBackfill.h @@ -15,10 +15,9 @@ #ifndef CEPH_MOSDPGBACKFILL_H #define CEPH_MOSDPGBACKFILL_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGBackfill : public Message { +class MOSDPGBackfill : public MOSDFastDispatchOp { static const int HEAD_VERSION = 3; static const int COMPAT_VERSION = 1; public: @@ -43,6 +42,13 @@ public: bool compat_stat_sum; pg_stat_t stats; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + virtual void decode_payload() { bufferlist::iterator p = payload.begin(); ::decode(op, p); @@ -85,11 +91,11 @@ public: ::encode(pgid.shard, payload); } - MOSDPGBackfill() : - Message(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), - compat_stat_sum(false) {} + MOSDPGBackfill() + : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), + compat_stat_sum(false) {} MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, spg_t p) - : Message(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), op(o), map_epoch(e), query_epoch(e), pgid(p), diff --git a/src/messages/MOSDPGPull.h b/src/messages/MOSDPGPull.h index a6b748c8df6f..c274e06ef971 100644 --- a/src/messages/MOSDPGPull.h +++ b/src/messages/MOSDPGPull.h @@ -15,10 +15,9 @@ #ifndef MOSDPGPULL_H #define MOSDPGPULL_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGPull : public Message { +class MOSDPGPull : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; @@ -30,9 +29,16 @@ public: vector pulls; uint64_t cost; - MOSDPGPull() : - Message(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION), - cost(0) + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + + MOSDPGPull() + : MOSDFastDispatchOp(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION), + cost(0) {} void compute_cost(CephContext *cct) { diff --git a/src/messages/MOSDPGPush.h b/src/messages/MOSDPGPush.h index 9bf0470ed6a1..b463b8ba00be 100644 --- a/src/messages/MOSDPGPush.h +++ b/src/messages/MOSDPGPush.h @@ -15,10 +15,9 @@ #ifndef MOSDPGPUSH_H #define MOSDPGPUSH_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGPush : public Message { +class MOSDPGPush : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; @@ -46,13 +45,20 @@ public: return cost; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + void set_cost(uint64_t c) { cost = c; } - MOSDPGPush() : - Message(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION), - cost(0) + MOSDPGPush() + : MOSDFastDispatchOp(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION), + cost(0) {} virtual void decode_payload() { diff --git a/src/messages/MOSDPGPushReply.h b/src/messages/MOSDPGPushReply.h index 793709e1650d..52e3ddd8a589 100644 --- a/src/messages/MOSDPGPushReply.h +++ b/src/messages/MOSDPGPushReply.h @@ -15,10 +15,9 @@ #ifndef MOSDPGPUSHREPLY_H #define MOSDPGPUSHREPLY_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGPushReply : public Message { +class MOSDPGPushReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; @@ -29,9 +28,16 @@ public: vector replies; uint64_t cost; - MOSDPGPushReply() : - Message(MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION), - cost(0) + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + + MOSDPGPushReply() + : MOSDFastDispatchOp(MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION), + cost(0) {} void compute_cost(CephContext *cct) { diff --git a/src/messages/MOSDPGScan.h b/src/messages/MOSDPGScan.h index f5fe18e523b7..9f66bd0e4806 100644 --- a/src/messages/MOSDPGScan.h +++ b/src/messages/MOSDPGScan.h @@ -15,10 +15,9 @@ #ifndef CEPH_MOSDPGSCAN_H #define CEPH_MOSDPGSCAN_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGScan : public Message { +class MOSDPGScan : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; @@ -42,6 +41,13 @@ public: spg_t pgid; hobject_t begin, end; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + virtual void decode_payload() { bufferlist::iterator p = payload.begin(); ::decode(op, p); @@ -79,10 +85,11 @@ public: ::encode(pgid.shard, payload); } - MOSDPGScan() : Message(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION) {} + MOSDPGScan() + : MOSDFastDispatchOp(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGScan(__u32 o, pg_shard_t from, epoch_t e, epoch_t qe, spg_t p, hobject_t be, hobject_t en) - : Message(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION), op(o), map_epoch(e), query_epoch(e), from(from), diff --git a/src/messages/MOSDPGUpdateLogMissing.h b/src/messages/MOSDPGUpdateLogMissing.h index 55e50d6a4626..b6a597705d56 100644 --- a/src/messages/MOSDPGUpdateLogMissing.h +++ b/src/messages/MOSDPGUpdateLogMissing.h @@ -16,9 +16,9 @@ #ifndef CEPH_MOSDPGUPDATELOGMISSING_H #define CEPH_MOSDPGUPDATELOGMISSING_H -#include "msg/Message.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGUpdateLogMissing : public Message { +class MOSDPGUpdateLogMissing : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -35,16 +35,24 @@ public: spg_t get_pgid() const { return pgid; } epoch_t get_query_epoch() const { return map_epoch; } ceph_tid_t get_tid() const { return rep_tid; } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } - MOSDPGUpdateLogMissing() : - Message(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION) { } + MOSDPGUpdateLogMissing() + : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, + COMPAT_VERSION) { } MOSDPGUpdateLogMissing( const mempool::osd::list &entries, spg_t pgid, shard_id_t from, epoch_t epoch, ceph_tid_t rep_tid) - : Message(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, + COMPAT_VERSION), map_epoch(epoch), pgid(pgid), from(from), diff --git a/src/messages/MOSDPGUpdateLogMissingReply.h b/src/messages/MOSDPGUpdateLogMissingReply.h index d6ff1407147a..34e8d9e6c1d0 100644 --- a/src/messages/MOSDPGUpdateLogMissingReply.h +++ b/src/messages/MOSDPGUpdateLogMissingReply.h @@ -16,9 +16,9 @@ #ifndef CEPH_MOSDPGUPDATELOGMISSINGREPLY_H #define CEPH_MOSDPGUPDATELOGMISSINGREPLY_H -#include "msg/Message.h" +#include "MOSDFastDispatchOp.h" -class MOSDPGUpdateLogMissingReply : public Message { +class MOSDPGUpdateLogMissingReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -37,9 +37,15 @@ public: pg_shard_t get_from() const { return pg_shard_t(get_source().num(), from); } + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } - MOSDPGUpdateLogMissingReply() : - Message( + MOSDPGUpdateLogMissingReply() + : MOSDFastDispatchOp( MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION) @@ -49,7 +55,7 @@ public: shard_id_t from, epoch_t epoch, ceph_tid_t rep_tid) - : Message( + : MOSDFastDispatchOp( MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION), diff --git a/src/messages/MOSDRepOp.h b/src/messages/MOSDRepOp.h index e6acca663095..de5e4755697b 100644 --- a/src/messages/MOSDRepOp.h +++ b/src/messages/MOSDRepOp.h @@ -16,14 +16,13 @@ #ifndef CEPH_MOSDREPOP_H #define CEPH_MOSDREPOP_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" /* * OSD sub op - for internal ops on pobjects between primary and replicas(/stripes/whatever) */ -class MOSDRepOp : public Message { +class MOSDRepOp : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; @@ -64,6 +63,13 @@ public: /// non-empty if this transaction involves a hit_set history update boost::optional updated_hit_set_history; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + int get_cost() const { return data.length(); } @@ -116,13 +122,13 @@ public: } MOSDRepOp() - : Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), map_epoch(0), final_decode_needed(true), acks_wanted (0) {} MOSDRepOp(osd_reqid_t r, pg_shard_t from, spg_t p, const hobject_t& po, int aw, epoch_t mape, ceph_tid_t rtid, eversion_t v) - : Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), map_epoch(mape), reqid(r), pgid(p), diff --git a/src/messages/MOSDRepOpReply.h b/src/messages/MOSDRepOpReply.h index 1632ffbf4b39..67c2d76bf735 100644 --- a/src/messages/MOSDRepOpReply.h +++ b/src/messages/MOSDRepOpReply.h @@ -16,7 +16,7 @@ #ifndef CEPH_MOSDREPOPREPLY_H #define CEPH_MOSDREPOPREPLY_H -#include "msg/Message.h" +#include "MOSDFastDispatchOp.h" #include "os/ObjectStore.h" @@ -28,7 +28,7 @@ * */ -class MOSDRepOpReply : public Message { +class MOSDRepOpReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 1; static const int COMPAT_VERSION = 1; public: @@ -50,6 +50,13 @@ public: // Decoding flags. Decoding is only needed for messages catched by pipe reader. bool final_decode_needed; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + virtual void decode_payload() { p = payload.begin(); ::decode(map_epoch, p); @@ -93,7 +100,7 @@ public: public: MOSDRepOpReply( MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, int at) : - Message(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), + MOSDFastDispatchOp(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(e), reqid(req->reqid), from(from), @@ -104,7 +111,8 @@ public: set_tid(req->get_tid()); } MOSDRepOpReply() - : Message(MSG_OSD_REPOPREPLY), map_epoch(0), + : MOSDFastDispatchOp(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), + map_epoch(0), ack_type(0), result(0), final_decode_needed(true) {} private: diff --git a/src/messages/MOSDRepScrub.h b/src/messages/MOSDRepScrub.h index fb4080e70467..07e04543b26e 100644 --- a/src/messages/MOSDRepScrub.h +++ b/src/messages/MOSDRepScrub.h @@ -16,13 +16,13 @@ #ifndef CEPH_MOSDREPSCRUB_H #define CEPH_MOSDREPSCRUB_H -#include "msg/Message.h" +#include "MOSDFastDispatchOp.h" /* * instruct an OSD initiate a replica scrub on a specific PG */ -struct MOSDRepScrub : public Message { +struct MOSDRepScrub : public MOSDFastDispatchOp { static const int HEAD_VERSION = 6; static const int COMPAT_VERSION = 2; @@ -37,15 +37,22 @@ struct MOSDRepScrub : public Message { bool deep; // true if scrub should be deep uint32_t seed; // seed value for digest calculation + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + MOSDRepScrub() - : Message(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), chunky(false), deep(false), seed(0) { } MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, hobject_t start, hobject_t end, bool deep, uint32_t seed) - : Message(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), scrub_to(scrub_to), map_epoch(map_epoch), diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h index cfc3afc4af41..bfd8d4dbe31e 100644 --- a/src/messages/MOSDSubOp.h +++ b/src/messages/MOSDSubOp.h @@ -16,8 +16,7 @@ #ifndef CEPH_MOSDSUBOP_H #define CEPH_MOSDSUBOP_H -#include "msg/Message.h" -#include "osd/osd_types.h" +#include "MOSDFastDispatchOp.h" #include "include/ceph_features.h" @@ -25,7 +24,7 @@ * OSD sub op - for internal ops on pobjects between primary and replicas(/stripes/whatever) */ -class MOSDSubOp : public Message { +class MOSDSubOp : public MOSDFastDispatchOp { static const int HEAD_VERSION = 12; static const int COMPAT_VERSION = 7; @@ -93,6 +92,13 @@ public: /// non-empty if this transaction involves a hit_set history update boost::optional updated_hit_set_history; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + int get_cost() const { if (ops.size() == 1 && ops[0].op.op == CEPH_OSD_OP_PULL) return ops[0].op.extent.length; @@ -239,11 +245,11 @@ public: } MOSDSubOp() - : Message(MSG_OSD_SUBOP, HEAD_VERSION, COMPAT_VERSION) { } + : MOSDFastDispatchOp(MSG_OSD_SUBOP, HEAD_VERSION, COMPAT_VERSION) { } MOSDSubOp(osd_reqid_t r, pg_shard_t from, spg_t p, const hobject_t& po, int aw, epoch_t mape, ceph_tid_t rtid, eversion_t v) - : Message(MSG_OSD_SUBOP, HEAD_VERSION, COMPAT_VERSION), + : MOSDFastDispatchOp(MSG_OSD_SUBOP, HEAD_VERSION, COMPAT_VERSION), map_epoch(mape), reqid(r), from(from), diff --git a/src/messages/MOSDSubOpReply.h b/src/messages/MOSDSubOpReply.h index 81d1b2836de3..aa300efc9314 100644 --- a/src/messages/MOSDSubOpReply.h +++ b/src/messages/MOSDSubOpReply.h @@ -16,7 +16,7 @@ #ifndef CEPH_MOSDSUBOPREPLY_H #define CEPH_MOSDSUBOPREPLY_H -#include "msg/Message.h" +#include "MOSDFastDispatchOp.h" #include "MOSDSubOp.h" #include "os/ObjectStore.h" @@ -29,7 +29,7 @@ * */ -class MOSDSubOpReply : public Message { +class MOSDSubOpReply : public MOSDFastDispatchOp { static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; public: @@ -53,6 +53,13 @@ public: map attrset; + epoch_t get_map_epoch() const override { + return map_epoch; + } + spg_t get_spg() const override { + return pgid; + } + virtual void decode_payload() { bufferlist::iterator p = payload.begin(); ::decode(map_epoch, p); @@ -129,20 +136,21 @@ public: public: MOSDSubOpReply( - MOSDSubOp *req, pg_shard_t from, int result_, epoch_t e, int at) : - Message(MSG_OSD_SUBOPREPLY, HEAD_VERSION, COMPAT_VERSION), - map_epoch(e), - reqid(req->reqid), - from(from), - pgid(req->pgid.pgid, req->from.shard), - poid(req->poid), - ops(req->ops), - ack_type(at), - result(result_) { + MOSDSubOp *req, pg_shard_t from, int result_, epoch_t e, int at) + : MOSDFastDispatchOp(MSG_OSD_SUBOPREPLY, HEAD_VERSION, COMPAT_VERSION), + map_epoch(e), + reqid(req->reqid), + from(from), + pgid(req->pgid.pgid, req->from.shard), + poid(req->poid), + ops(req->ops), + ack_type(at), + result(result_) { memset(&peer_stat, 0, sizeof(peer_stat)); set_tid(req->get_tid()); } - MOSDSubOpReply() : Message(MSG_OSD_SUBOPREPLY) {} + MOSDSubOpReply() + : MOSDFastDispatchOp(MSG_OSD_SUBOPREPLY, HEAD_VERSION, COMPAT_VERSION) {} private: ~MOSDSubOpReply() {}