From: Li Wang Date: Thu, 19 Dec 2013 06:33:34 +0000 (+0800) Subject: ceph: Add inline fields to MClientCaps X-Git-Tag: v0.78~234^2^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ac5c9dd3f7174f3a3f7a230a405a15f354918ddd;p=ceph.git ceph: Add inline fields to MClientCaps Signed-off-by: Yunchuan Wen Signed-off-by: Li Wang --- diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 8eeaafd5950..11c8068df7f 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -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; + } } };