@@ -1100,14 +1100,12 @@ void CInode::encode_lock_state(int type, bufferlist& bl)
case CEPH_LOCK_IFILE:
if (is_auth()) {
+ ::encode(inode.layout, bl);
+ ::encode(inode.size, bl);
::encode(inode.mtime, bl);
::encode(inode.atime, bl);
::encode(inode.time_warp_seq, bl);
- if (!is_dir()) {
- ::encode(inode.layout, bl);
- ::encode(inode.size, bl);
- ::encode(inode.client_ranges, bl);
- }
+ ::encode(inode.client_ranges, bl);
} else {
bool dirty = filelock.is_dirty();
::encode(dirty, bl);
@@ -1189,7 +1187,13 @@ void CInode::encode_lock_state(int type, bufferlist& bl)
case CEPH_LOCK_IPOLICY:
if (inode.is_dir()) {
- ::encode(inode.layout, bl);
+ bool has_layout = inode.has_layout();
+ ::encode(has_layout, bl);
+ if (has_layout) {
+ __u8 lv = 1;
+ ::encode(lv, bl);
+ ::encode(inode.layout, bl);
+ }
}
break;
@@ -1283,14 +1287,12 @@ void CInode::decode_lock_state(int type, bufferlist& bl)
case CEPH_LOCK_IFILE:
if (!is_auth()) {
+ ::decode(inode.layout, p);
+ ::decode(inode.size, p);
::decode(inode.mtime, p);
::decode(inode.atime, p);
::decode(inode.time_warp_seq, p);
- if (!is_dir()) {
- ::decode(inode.layout, p);
- ::decode(inode.size, p);
- ::decode(inode.client_ranges, p);
- }
+ ::decode(inode.client_ranges, p);
} else {
bool replica_dirty;
::decode(replica_dirty, p);
@@ -1432,7 +1434,14 @@ void CInode::decode_lock_state(int type, bufferlist& bl)
case CEPH_LOCK_IPOLICY:
if (inode.is_dir()) {
- ::decode(inode.layout, p);
+ bool has_layout;
+ ::decode(has_layout, p);
+ if (has_layout) {
+ __u8 lv;
+ ::decode(lv, p);
+ assert(lv == 1);
+ ::decode(inode.layout, p);
+ }
}
break;
@@ -530,7 +530,7 @@ private:
unsigned encode_parent_mutation(ObjectOperation& m);
void encode_store(bufferlist& bl) {
- __u8 struct_v = 3;
+ __u8 struct_v = 2;
::encode(struct_v, bl);
::encode(inode, bl);
if (is_symlink())
@@ -541,6 +541,15 @@ private:
encode_snap_blob(snapbl);
::encode(snapbl, bl);
::encode(old_inodes, bl);
+ if (struct_v == 2 && inode.is_dir()) { // FIXME: this is redundant
+ bool has_layout = inode.has_layout();
+ ::encode(has_layout, bl);
+ if (has_layout) {
+ __u8 lv = 1;
+ ::encode(lv, bl);
+ ::encode(inode.layout, bl);
+ }
+ }
}
void decode_store(bufferlist::iterator& bl) {
__u8 struct_v;
@@ -555,10 +564,12 @@ private:
decode_snap_blob(snapbl);
::decode(old_inodes, bl);
if (struct_v == 2 && inode.is_dir()) {
- bool default_layout_exists;
- ::decode(default_layout_exists, bl);
- if (default_layout_exists) {
- ::decode(struct_v, bl);
+ bool has_layout;
+ ::decode(has_layout, bl);
+ if (has_layout) {
+ __u8 lv;
+ ::decode(lv, bl);
+ assert (lv == 1);
::decode(inode.layout, bl);
}
}
@@ -576,6 +587,15 @@ private:
_encode_base(bl);
_encode_locks_state_for_replica(bl);
+ if (inode.is_dir()) { // FIXME: this is redundant
+ bool has_layout = inode.has_layout();
+ ::encode(has_layout, bl);
+ if (has_layout) {
+ __u8 lv = 1;
+ ::encode(lv, bl);
+ ::encode(inode.layout, bl);
+ }
+ }
}
void decode_replica(bufferlist::iterator& p, bool is_new) {
__u32 nonce;
@@ -584,6 +604,16 @@ private:
_decode_base(p);
_decode_locks_state(p, is_new);
+ if (inode.is_dir()) { // FIXME: this is redundant
+ bool has_layout;
+ ::decode(has_layout, p);
+ if (has_layout) {
+ __u8 lv;
+ ::decode(lv, p);
+ assert(lv == 1);
+ ::decode(inode.layout, p);
+ }
+ }
}
@@ -35,7 +35,7 @@
#include "SessionMap.h"
-#define CEPH_MDS_PROTOCOL 15 /* cluster internal */
+#define CEPH_MDS_PROTOCOL 14 /* cluster internal */
enum {
@@ -97,6 +97,15 @@ public:
if (i.is_dir()) {
::encode(dft, _enc);
::encode(sbl, _enc);
+ if (struct_v >= 2 && struct_v <= 3) { // FIXME: this is redundant
+ bool has_layout = i.has_layout();
+ ::encode(has_layout, _enc);
+ if (has_layout) {
+ __u8 lv = 1;
+ ::encode(lv, _enc);
+ ::encode(inode.layout, _enc);
+ }
+ }
}
::encode(dr, _enc);
::encode(oi ? true : false, _enc);
@@ -110,8 +119,6 @@ public:
~fullbit() {}
void encode(bufferlist& bl) const {
- __u8 struct_v = 3;
- ::encode(struct_v, bl);
assert(_enc.length());
bl.append(_enc);
}
@@ -129,11 +136,13 @@ public:
if (inode.is_dir()) {
::decode(dirfragtree, bl);
::decode(snapbl, bl);
- if (struct_v == 2) {
- bool dir_layout_exists;
- ::decode(dir_layout_exists, bl);
- if (dir_layout_exists) {
- ::decode(struct_v, bl);
+ if (struct_v >= 2 && struct_v <= 3) {
+ bool has_layout;
+ ::decode(has_layout, bl);
+ if (has_layout) {
+ __u8 lv;
+ ::decode(lv, bl);
+ assert(lv == 1);
::decode(inode.layout, bl);
}
}