]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set features explicitly in MOSDOp
authorSage Weil <sage@redhat.com>
Mon, 16 Feb 2015 15:57:00 +0000 (07:57 -0800)
committerSage Weil <sage@redhat.com>
Mon, 16 Feb 2015 17:21:41 +0000 (09:21 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/include/ceph_features.h
src/messages/MOSDOp.h
src/msg/Message.h
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 24077e0b51afbd77c7776d2d936c7925fa73022a..ef5d3f2b5dd91de91e34fa45173396ddc5401f99 100644 (file)
@@ -63,6 +63,7 @@
 #define CEPH_FEATURE_OSD_MIN_SIZE_RECOVERY (1ULL<<49)
 // duplicated since it was introduced at the same time as MIN_SIZE_RECOVERY
 #define CEPH_FEATURE_OSD_DEGRADED_WRITES (1ULL<<49)
+#define CEPH_FEATURE_OSD_PROXY_FEATURES (1ULL<<49)  /* overlap w/ above */
 
 #define CEPH_FEATURE_RESERVED2 (1ULL<<61)  /* slow down, we are almost out... */
 #define CEPH_FEATURE_RESERVED  (1ULL<<62)  /* DO NOT USE THIS ... last bit! */
index 581215f72071c231d0a8230a9e22392e3f6ba2c2..5b88f319ebd81330bb35c35dbca1d7303423400b 100644 (file)
@@ -32,7 +32,7 @@ class OSD;
 
 class MOSDOp : public Message {
 
-  static const int HEAD_VERSION = 4;
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 3;
 
 private:
@@ -54,6 +54,8 @@ private:
   snapid_t snap_seq;
   vector<snapid_t> snaps;
 
+  uint64_t features;
+
 public:
   friend class MOSDOpReply;
 
@@ -94,11 +96,12 @@ public:
     : Message(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION) { }
   MOSDOp(int inc, long tid,
          object_t& _oid, object_locator_t& _oloc, pg_t& _pgid, epoch_t _osdmap_epoch,
-        int _flags)
+        int _flags, uint64_t feat)
     : Message(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION),
       client_inc(inc),
       osdmap_epoch(_osdmap_epoch), flags(_flags), retry_attempt(-1),
-      oid(_oid), oloc(_oloc), pgid(_pgid) {
+      oid(_oid), oloc(_oloc), pgid(_pgid),
+      features(feat) {
     set_tid(tid);
   }
 private:
@@ -143,6 +146,12 @@ public:
     add_simple_op(CEPH_OSD_OP_STAT, 0, 0);
   }
 
+  uint64_t get_features() const {
+    if (features)
+      return features;
+    return get_connection()->get_features();
+  }
+
   // flags
   int get_flags() const { return flags; }
 
@@ -251,6 +260,7 @@ struct ceph_osd_request_head {
       ::encode(snaps, payload);
 
       ::encode(retry_attempt, payload);
+      ::encode(features, payload);
     }
   }
 
@@ -297,6 +307,7 @@ struct ceph_osd_request_head {
                                oid.name.length()));
 
       retry_attempt = -1;
+      features = 0;
     } else {
       // new decode 
       ::decode(client_inc, p);
@@ -332,6 +343,11 @@ struct ceph_osd_request_head {
        ::decode(retry_attempt, p);
       else
        retry_attempt = -1;
+
+      if (header.version >= 5)
+       ::decode(features, p);
+      else
+       features = 0;
     }
 
     OSDOp::split_osd_op_vector_in_data(ops, data);
index e1aa98d66ab1d11bd79956ac7ffc68e735c4b9db..c2cd1238150e71be5420ea497ee3433eb9a9b957 100644 (file)
@@ -301,7 +301,7 @@ protected:
       completion_hook->complete(0);
   }
 public:
-  inline const ConnectionRef& get_connection() { return connection; }
+  inline const ConnectionRef& get_connection() const { return connection; }
   void set_connection(const ConnectionRef& c) {
     connection = c;
   }
index 8ce7f8777ac7c0189ee3d22cf696adb771c9f68a..43c094c495c257dc621fd3deb6daa520abcf7bd0 100644 (file)
@@ -2758,7 +2758,7 @@ MOSDOp *Objecter::_prepare_osd_op(Op *op)
                         op->target.target_oid, op->target.target_oloc,
                         op->target.pgid,
                         osdmap->get_epoch(),
-                        flags);
+                        flags, op->features);
 
   m->set_snapid(op->snapid);
   m->set_snap_seq(op->snapc.seq);
index e29d16bbe99c368294bf470396a57104f4af88c0..fecf6cd9b2c8b043cad05f9c61ea6eb28ddf7569 100644 (file)
@@ -1146,6 +1146,7 @@ public:
     op_target_t target;
 
     ConnectionRef con;  // for rx buffer only
+    uint64_t features;  // explicitly specified op features
 
     vector<OSDOp> ops;
 
@@ -1189,6 +1190,7 @@ public:
       session(NULL), incarnation(0),
       target(o, ol, f),
       con(NULL),
+      features(CEPH_FEATURES_SUPPORTED_DEFAULT),
       snapid(CEPH_NOSNAP),
       outbl(NULL),
       priority(0), onack(ac), oncommit(co),