From 65b04085acafe37d347324fea87dfc6cd2d0d7a0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 3 Jul 2020 20:33:04 +0800 Subject: [PATCH] mds: do not decode EMetaBlob::fullbit struct_v < 8 the struct_v of EMetaBlob::fullbit::encode was bumped from 7 to 8 in d62c67ca2041797fc7aa212ae4a37ba91e5620e7, the oldest release containing this change was hammer rc1. `EMetaBlob::fullbit` is used to persist dentry + inode as part of journal, after the journal is flushed to the metadata pool, and applied to dirty metadata, the flushed segments are trimmed. also, it's not allowed to upgrade a Ceph cluster across 2 releases. so, there is no need to decode an on-disk struct which will be trimmmed as part of journal recycling, and that struct was encoded in hammer. Signed-off-by: Kefu Chai --- src/mds/journal.cc | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 70face21f1c53..42139d96f2002 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -420,7 +420,7 @@ void EMetaBlob::fullbit::encode(bufferlist& bl, uint64_t features) const { } void EMetaBlob::fullbit::decode(bufferlist::const_iterator &bl) { - DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl); + DECODE_START(8, bl); decode(dn, bl); decode(dnfirst, bl); decode(dnlast, bl); @@ -432,40 +432,17 @@ void EMetaBlob::fullbit::decode(bufferlist::const_iterator &bl) { if (inode.is_dir()) { decode(dirfragtree, bl); decode(snapbl, bl); - if ((struct_v == 2) || (struct_v == 3)) { - bool dir_layout_exists; - decode(dir_layout_exists, bl); - if (dir_layout_exists) { - __u8 dir_struct_v; - decode(dir_struct_v, bl); // default_file_layout version - decode(inode.layout, bl); // and actual layout, that we care about - } - } - } - if (struct_v >= 6) { - decode(state, bl); - } else { - bool dirty; - decode(dirty, bl); - state = dirty ? EMetaBlob::fullbit::STATE_DIRTY : 0; } - - if (struct_v >= 3) { - bool old_inodes_present; - decode(old_inodes_present, bl); - if (old_inodes_present) { - decode(old_inodes, bl); - } + decode(state, bl); + bool old_inodes_present; + decode(old_inodes_present, bl); + if (old_inodes_present) { + decode(old_inodes, bl); } if (!inode.is_dir()) { - if (struct_v >= 7) - decode(snapbl, bl); + decode(snapbl, bl); } - if (struct_v >= 8) - decode(oldest_snap, bl); - else - oldest_snap = CEPH_NOSNAP; - + decode(oldest_snap, bl); DECODE_FINISH(bl); } -- 2.39.5