]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: Add inline fields to MClientCaps
authorLi Wang <liwang@ubuntukylin.com>
Thu, 19 Dec 2013 06:33:34 +0000 (14:33 +0800)
committerYunchuan Wen <yunchuanwen@ubuntukylin.com>
Mon, 27 Jan 2014 07:24:58 +0000 (15:24 +0800)
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
Signed-off-by: Li Wang <liwang@ubuntukylin.com>
src/messages/MClientCaps.h

index 8eeaafd595005c39d604e0fc1eff59645d98041d..11c8068df7f7c4cb91f991e6ffbffe348e63682f 100644 (file)
@@ -21,7 +21,7 @@
 
 class MClientCaps : public Message {
 
-  static const int HEAD_VERSION = 3;   // added flock metadata
+  static const int HEAD_VERSION = 4;   // added flock metadata, inline data
   static const int COMPAT_VERSION = 1;
 
  public:
@@ -30,6 +30,8 @@ class MClientCaps : public Message {
   bufferlist snapbl;
   bufferlist xattrbl;
   bufferlist flockbl;
+  version_t  inline_version;
+  bufferlist inline_data;
 
   int      get_caps() { return head.caps; }
   int      get_wanted() { return head.wanted; }
@@ -83,7 +85,9 @@ class MClientCaps : public Message {
   }
 
   MClientCaps()
-    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) { }
+    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {
+    inline_version = 0;
+  }
   MClientCaps(int op,
              inodeno_t ino,
              inodeno_t realm,
@@ -105,6 +109,7 @@ class MClientCaps : public Message {
     head.dirty = dirty;
     head.migrate_seq = mseq;
     peer.cap_id = 0;
+    inline_version = 0;
   }
   MClientCaps(int op,
              inodeno_t ino, inodeno_t realm,
@@ -117,6 +122,7 @@ class MClientCaps : public Message {
     head.cap_id = id;
     head.migrate_seq = mseq;
     peer.cap_id = 0;
+    inline_version = 0;
   }
 private:
   ~MClientCaps() {}
@@ -169,6 +175,13 @@ public:
       else if (head.op == CEPH_CAP_OP_EXPORT)
        memcpy(&peer, &head.peer, sizeof(peer));
     }
+
+    if (header.version >= 4) {
+      ::decode(inline_version, p);
+      ::decode(inline_data, p);
+    } else {
+      inline_version = CEPH_INLINE_NONE;
+    }
   }
   void encode_payload(uint64_t features) {
     head.snap_trace_len = snapbl.length();
@@ -198,6 +211,14 @@ public:
       header.version = 2;
       return;
     }
+
+    if (features & CEPH_FEATURE_MDS_INLINE_DATA) {
+      ::encode(inline_version, payload);
+      ::encode(inline_data, payload);
+    } else {
+      header.version = 3;
+      return;
+    }
   }
 };