]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: do not decode EMetaBlob::fullbit struct_v < 8 35931/head
authorKefu Chai <kchai@redhat.com>
Fri, 3 Jul 2020 12:33:04 +0000 (20:33 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 11 Jul 2020 17:19:37 +0000 (01:19 +0800)
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 <kchai@redhat.com>
src/mds/journal.cc

index 70face21f1c53bdc15033e2932d96a287f6f1aa2..42139d96f20024fc459958db8f69a2981657eaa3 100644 (file)
@@ -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);
 }