]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MOSDRepScrub: Adds a message for initiating a replica scrub
authorSamuel Just <samuel.just@dreamhost.com>
Thu, 3 Feb 2011 22:29:43 +0000 (14:29 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 8 Feb 2011 04:56:01 +0000 (20:56 -0800)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/messages/MOSDRepScrub.h [new file with mode: 0644]
src/msg/Message.cc
src/msg/Message.h

diff --git a/src/messages/MOSDRepScrub.h b/src/messages/MOSDRepScrub.h
new file mode 100644 (file)
index 0000000..67fa723
--- /dev/null
@@ -0,0 +1,62 @@
+// -*- 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 <sage@newdream.net>
+ *
+ * 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_MOSDREPSCRUB_H
+#define CEPH_MOSDREPSCRUB_H
+
+#include "msg/Message.h"
+
+/*
+ * instruct an OSD initiate a replica scrub on a specific PG
+ */
+
+struct MOSDRepScrub : public Message {
+  pg_t pgid;             // PG to scrub
+  eversion_t scrub_from; // only scrub log entries after scrub_from
+  epoch_t map_epoch;
+
+  MOSDRepScrub() {}
+  MOSDRepScrub(pg_t pgid, eversion_t scrub_from, epoch_t map_epoch) :
+    Message(MSG_OSD_REP_SCRUB),
+    pgid(pgid),
+    scrub_from(scrub_from),
+    map_epoch(map_epoch) {}
+  
+private:
+  ~MOSDRepScrub() {}
+
+public:
+  const char *get_type_name() { return "replica scrub"; }
+  void print(ostream& out) {
+    out << "replica scrub(pg: ";
+    out << pgid << ",from:" << scrub_from << "epoch:" 
+        << map_epoch;
+    out << ")";
+  }
+
+  void encode_payload() {
+    ::encode(pgid, payload);
+    ::encode(scrub_from, payload);
+    ::encode(map_epoch, payload);
+  }
+  void decode_payload() {
+    bufferlist::iterator p = payload.begin();
+    ::decode(pgid, p);
+    ::decode(scrub_from, p);
+    ::decode(map_epoch, p);
+  }
+};
+
+#endif
index a38adb8e0f7c7ef50232e032331c31ad9d90febe..24e54cd07ec1f290ba947677dca198d1083dc5be 100644 (file)
@@ -58,6 +58,7 @@ using namespace std;
 #include "messages/MOSDPGTrim.h"
 #include "messages/MOSDPGMissing.h"
 #include "messages/MOSDScrub.h"
+#include "messages/MOSDRepScrub.h"
 
 #include "messages/MRemoveSnaps.h"
 
@@ -317,6 +318,9 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
   case MSG_OSD_PG_MISSING:
     m = new MOSDPGMissing;
     break;
+  case MSG_OSD_REP_SCRUB:
+    m = new MOSDRepScrub;
+    break;
    // auth
   case CEPH_MSG_AUTH:
     m = new MAuth;
index d161cb4033422b0d7b15d8a63915c4a6c3cf7e26..d49d13ee0de0a7957b96ef2c4659e69548a16a25 100644 (file)
@@ -74,6 +74,7 @@
 
 #define MSG_OSD_SCRUB          91
 #define MSG_OSD_PG_MISSING     92
+#define MSG_OSD_REP_SCRUB      93