From e4ab0e3b17933df675ec209282a6483bd6a373a1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 1 Dec 2011 16:56:27 -0800 Subject: [PATCH] osd: add MOSDPGBackfill message Signed-off-by: Sage Weil --- src/Makefile.am | 1 + src/messages/MOSDPGBackfill.h | 80 +++++++++++++++++++++++++++++++++++ src/msg/Message.cc | 4 ++ src/msg/Message.h | 1 + 4 files changed, 86 insertions(+) create mode 100644 src/messages/MOSDPGBackfill.h diff --git a/src/Makefile.am b/src/Makefile.am index b604fa365986c..b533bd0bcf78f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1314,6 +1314,7 @@ noinst_HEADERS = \ messages/MOSDMap.h\ messages/MOSDOp.h\ messages/MOSDOpReply.h\ + messages/MOSDPGBackfill.h\ messages/MOSDPGCreate.h\ messages/MOSDPGInfo.h\ messages/MOSDPGLog.h\ diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h new file mode 100644 index 0000000000000..14b19c5e48e8b --- /dev/null +++ b/src/messages/MOSDPGBackfill.h @@ -0,0 +1,80 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2004-2006 Sage Weil + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef CEPH_MOSDPGBACKFILL_H +#define CEPH_MOSDPGBACKFILL_H + +#include "msg/Message.h" +#include "osd/osd_types.h" + +class MOSDPGBackfill : public Message { +public: + enum { + OP_BACKFILL_PROGRESS = 2, + OP_BACKFILL_FINISH = 3, + OP_BACKFILL_FINISH_ACK = 4, + }; + const char *get_op_name(int o) { + switch (o) { + case OP_BACKFILL_PROGRESS: return "progress"; + case OP_BACKFILL_FINISH: return "finish"; + case OP_BACKFILL_FINISH_ACK: return "finish_ack"; + default: return "???"; + } + } + + __u32 op; + epoch_t map_epoch, query_epoch; + pg_t pgid; + interval_set incomplete; + + virtual void decode_payload(CephContext *cct) { + bufferlist::iterator p = payload.begin(); + ::decode(op, p); + ::decode(map_epoch, p); + ::decode(query_epoch, p); + ::decode(pgid, p); + ::decode(incomplete, p); + } + + virtual void encode_payload(CephContext *cct) { + ::encode(op, payload); + ::encode(map_epoch, payload); + ::encode(query_epoch, payload); + ::encode(pgid, payload); + ::encode(incomplete, payload); + } + + MOSDPGBackfill() : Message(MSG_OSD_PG_BACKFILL) {} + MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, pg_t p) + : Message(MSG_OSD_PG_BACKFILL), + op(o), + map_epoch(e), query_epoch(e), + pgid(p) { + } +private: + ~MOSDPGBackfill() {} + +public: + const char *get_type_name() { return "pg_backfill"; } + void print(ostream& out) { + out << "pg_backfill(" << get_op_name(op) + << " " << pgid + << " e " << map_epoch << "/" << query_epoch + << " incomp " << std::hex << incomplete << std::dec + << ")"; + } +}; + +#endif diff --git a/src/msg/Message.cc b/src/msg/Message.cc index cfdafdffc4058..6faee2073038a 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -66,6 +66,7 @@ using namespace std; #include "messages/MOSDScrub.h" #include "messages/MOSDRepScrub.h" #include "messages/MOSDPGScan.h" +#include "messages/MOSDPGBackfill.h" #include "messages/MRemoveSnaps.h" @@ -357,6 +358,9 @@ Message *decode_message(CephContext *cct, ceph_msg_header& header, ceph_msg_foot case MSG_OSD_PG_SCAN: m = new MOSDPGScan; break; + case MSG_OSD_PG_BACKFILL: + m = new MOSDPGBackfill; + break; // auth case CEPH_MSG_AUTH: m = new MAuth; diff --git a/src/msg/Message.h b/src/msg/Message.h index ac31e4bf915b9..f37a88424ffcb 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -79,6 +79,7 @@ #define MSG_OSD_REP_SCRUB 93 #define MSG_OSD_PG_SCAN 94 +#define MSG_OSD_PG_BACKFILL 95 #define MSG_COMMAND 97 #define MSG_COMMAND_REPLY 98 -- 2.39.5