From: Greg Farnum Date: Fri, 18 Jan 2013 00:15:49 +0000 (-0800) Subject: CInode: use modern encoding for encode_store X-Git-Tag: v0.58~100^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8a7b876066bbbaaf41fe2c8227607a8f21674f0;p=ceph.git CInode: use modern encoding for encode_store Signed-off-by: Greg Farnum --- diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index dc2b1fbba96..97e4b1fbd4c 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -1059,6 +1059,48 @@ void CInode::_stored_parent(version_t v, Context *fin) } } +void CInode::encode_store(bufferlist& bl) +{ + ENCODE_START(3, 3, bl); + ::encode(inode, bl); + if (is_symlink()) + ::encode(symlink, bl); + ::encode(dirfragtree, bl); + ::encode(xattrs, bl); + bufferlist snapbl; + encode_snap_blob(snapbl); + ::encode(snapbl, bl); + ::encode(old_inodes, bl); + if (inode.is_dir()) { + ::encode((default_layout ? true : false), bl); + if (default_layout) + ::encode(*default_layout, bl); + } + ENCODE_FINISH(bl); +} + +void CInode::decode_store(bufferlist::iterator& bl) { + DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl); + ::decode(inode, bl); + if (is_symlink()) + ::decode(symlink, bl); + ::decode(dirfragtree, bl); + ::decode(xattrs, bl); + bufferlist snapbl; + ::decode(snapbl, bl); + 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) { + delete default_layout; + default_layout = new file_layout_policy_t; + ::decode(*default_layout, bl); + } + } + DECODE_FINISH(bl); +} // ------------------ // locking diff --git a/src/mds/CInode.h b/src/mds/CInode.h index de783546e20..4a6063275a9 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -554,46 +554,8 @@ private: void build_backtrace(inode_backtrace_t& bt); unsigned encode_parent_mutation(ObjectOperation& m); - void encode_store(bufferlist& bl) { - __u8 struct_v = 2; - ::encode(struct_v, bl); - ::encode(inode, bl); - if (is_symlink()) - ::encode(symlink, bl); - ::encode(dirfragtree, bl); - ::encode(xattrs, bl); - bufferlist snapbl; - encode_snap_blob(snapbl); - ::encode(snapbl, bl); - ::encode(old_inodes, bl); - if (inode.is_dir()) { - ::encode((default_layout ? true : false), bl); - if (default_layout) - ::encode(*default_layout, bl); - } - } - void decode_store(bufferlist::iterator& bl) { - __u8 struct_v; - ::decode(struct_v, bl); - ::decode(inode, bl); - if (is_symlink()) - ::decode(symlink, bl); - ::decode(dirfragtree, bl); - ::decode(xattrs, bl); - bufferlist snapbl; - ::decode(snapbl, bl); - 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) { - delete default_layout; - default_layout = new file_layout_policy_t; - ::decode(*default_layout, bl); - } - } - } + void encode_store(bufferlist& bl); + void decode_store(bufferlist::iterator& bl); void encode_replica(int rep, bufferlist& bl) { assert(is_auth());