]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add MOSDBackoff message type
authorSage Weil <sage@redhat.com>
Mon, 17 Oct 2016 21:10:38 +0000 (17:10 -0400)
committerSage Weil <sage@redhat.com>
Fri, 10 Feb 2017 22:59:50 +0000 (17:59 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/ceph_strings.cc
src/include/ceph_fs.h
src/include/rados.h
src/messages/MOSDBackoff.h [new file with mode: 0644]
src/msg/Message.cc

index 08ed2715df49d0f7948d998f7b191aaa1697267f..1c13be4f884ff873736269a1e2ee099d38921c77 100644 (file)
@@ -238,3 +238,13 @@ const char *ceph_pool_op_name(int op)
        }
        return "???";
 }
+
+const char *ceph_osd_backoff_op_name(int op)
+{
+       switch (op) {
+       case CEPH_OSD_BACKOFF_OP_BLOCK: return "block";
+       case CEPH_OSD_BACKOFF_OP_ACK_BLOCK: return "ack-block";
+       case CEPH_OSD_BACKOFF_OP_UNBLOCK: return "unblock";
+       }
+       return "???";
+}
index ffc510813b90d2d88faabd2f791701128e770e71..2d1486d94c737ee339e976fb448c86e48e68abc1 100644 (file)
@@ -127,13 +127,13 @@ struct ceph_dir_layout {
 #define CEPH_MSG_OSD_OP                 42
 #define CEPH_MSG_OSD_OPREPLY            43
 #define CEPH_MSG_WATCH_NOTIFY           44
+#define CEPH_MSG_OSD_BACKOFF            61
 
 /* FSMap subscribers (see all MDS clusters at once) */
 #define CEPH_MSG_FS_MAP                 45
 /* FSMapUser subscribers (get MDS clusters name->ID mapping) */
 #define CEPH_MSG_FS_MAP_USER           103
 
-
 /* watch-notify operations */
 enum {
        CEPH_WATCH_EVENT_NOTIFY           = 1, /* notifying watcher */
index c045c360a68dc0ec96d00caf1e09600b843bd9fd..02a7f8c632e6ebb069253b518442672020063c0a 100644 (file)
@@ -472,6 +472,14 @@ enum {
 
 const char *ceph_osd_alloc_hint_flag_name(int f);
 
+enum {
+       CEPH_OSD_BACKOFF_OP_BLOCK = 1,
+       CEPH_OSD_BACKOFF_OP_ACK_BLOCK = 2,
+       CEPH_OSD_BACKOFF_OP_UNBLOCK = 3,
+};
+
+const char *ceph_osd_backoff_op_name(int op);
+
 /*
  * an individual object operation.  each may be accompanied by some data
  * payload
diff --git a/src/messages/MOSDBackoff.h b/src/messages/MOSDBackoff.h
new file mode 100644 (file)
index 0000000..e501269
--- /dev/null
@@ -0,0 +1,66 @@
+// -*- 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) 2017 Red Hat
+ *
+ * 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_MOSDBACKOFF_H
+#define CEPH_MOSDBACKOFF_H
+
+#include "msg/Message.h"
+#include "osd/osd_types.h"
+
+class MOSDBackoff : public Message {
+public:
+  uint8_t op = 0;           ///< CEPH_OSD_BACKOFF_OP_*
+  uint64_t id = 0;          ///< unique id within this session
+  hobject_t begin, end;     ///< [) range to block, unless ==, block single obj
+  epoch_t osd_epoch = 0;
+
+  MOSDBackoff() : Message(CEPH_MSG_OSD_BACKOFF) {}
+  MOSDBackoff(uint8_t op_, uint64_t id_,
+             hobject_t begin_, hobject_t end_, epoch_t ep)
+    : Message(CEPH_MSG_OSD_BACKOFF),
+      op(op_),
+      id(id_),
+      begin(begin_),
+      end(end_),
+      osd_epoch(ep) { }
+
+  void encode_payload(uint64_t features) override {
+    ::encode(op, payload);
+    ::encode(id, payload);
+    ::encode(begin, payload);
+    ::encode(end, payload);
+    ::encode(osd_epoch, payload);
+  }
+
+  void decode_payload() override {
+    auto p = payload.begin();
+    ::decode(op, p);
+    ::decode(id, p);
+    ::decode(begin, p);
+    ::decode(end, p);
+    ::decode(osd_epoch, p);
+  }
+
+  const char *get_type_name() const override { return "osd_backoff"; }
+
+  void print(ostream& out) const override {
+    out << "osd_backoff(" << ceph_osd_backoff_op_name(op)
+       << " id " << id
+       << " [" << begin << "," << end << ")"
+       << " epoch " << osd_epoch << ")";
+  }
+};
+
+#endif
index a9fa275648faa0cbc5be51d0ce58219347e55650..a226ecbca72c0033bbebc01c4bb073db189a9ccd 100644 (file)
@@ -82,6 +82,7 @@ using namespace std;
 #include "messages/MOSDRepScrub.h"
 #include "messages/MOSDPGScan.h"
 #include "messages/MOSDPGBackfill.h"
+#include "messages/MOSDBackoff.h"
 
 #include "messages/MRemoveSnaps.h"
 
@@ -460,6 +461,9 @@ Message *decode_message(CephContext *cct, int crcflags,
   case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY:
     m = new MOSDPGUpdateLogMissingReply();
     break;
+  case CEPH_MSG_OSD_BACKOFF:
+    m = new MOSDBackoff;
+    break;
 
   case CEPH_MSG_OSD_MAP:
     m = new MOSDMap;