]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: journal snaprealm for all types of inodes
authorYan, Zheng <zyan@redhat.com>
Fri, 19 Dec 2014 16:12:28 +0000 (00:12 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 5 Feb 2015 14:40:38 +0000 (22:40 +0800)
regular file also can has snaprealm.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/events/EMetaBlob.h
src/mds/journal.cc

index 661213d4fbf6e45af2555ccab531dbac67656157..d8fd4588ee054ba71affc86da5d17440f013689e 100644 (file)
@@ -86,12 +86,11 @@ public:
     {
       if (i.is_symlink())
        symlink = sym;
-      if (i.is_dir()) {
+      if (i.is_dir())
        dirfragtree = dft;
-       snapbl = sbl;
-      }
       if (oi)
        old_inodes = *oi;
+      snapbl = sbl;
     }
     fullbit(bufferlist::iterator &p) {
       decode(p);
index 51ac92c21da5559ea37f9d065ff26b0a2ba19e49..ace30bd27e8cbe6885a196d1e1e48b4aedbe7018 100644 (file)
@@ -397,7 +397,7 @@ void EMetaBlob::update_segment(LogSegment *ls)
 // EMetaBlob::fullbit
 
 void EMetaBlob::fullbit::encode(bufferlist& bl) const {
-  ENCODE_START(6, 5, bl);
+  ENCODE_START(7, 5, bl);
   ::encode(dn, bl);
   ::encode(dnfirst, bl);
   ::encode(dnlast, bl);
@@ -417,11 +417,13 @@ void EMetaBlob::fullbit::encode(bufferlist& bl) const {
     ::encode(true, bl);
     ::encode(old_inodes, bl);
   }
+  if (!inode.is_dir())
+    ::encode(snapbl, bl);
   ENCODE_FINISH(bl);
 }
 
 void EMetaBlob::fullbit::decode(bufferlist::iterator &bl) {
-  DECODE_START_LEGACY_COMPAT_LEN(6, 5, 5, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl);
   ::decode(dn, bl);
   ::decode(dnfirst, bl);
   ::decode(dnlast, bl);
@@ -458,6 +460,10 @@ void EMetaBlob::fullbit::decode(bufferlist::iterator &bl) {
       ::decode(old_inodes, bl);
     }
   }
+  if (!inode.is_dir()) {
+    if (struct_v >= 7)
+      ::decode(snapbl, bl);
+  }
   DECODE_FINISH(bl);
 }
 
@@ -538,17 +544,16 @@ void EMetaBlob::fullbit::update_inode(MDS *mds, CInode *in)
        }
       }
     }
-
-    /*
-     * we can do this before linking hte inode bc the split_at would
-     * be a no-op.. we have no children (namely open snaprealms) to
-     * divy up 
-     */
-    in->decode_snap_blob(snapbl);  
   } else if (in->inode.is_symlink()) {
     in->symlink = symlink;
   }
   in->old_inodes = old_inodes;
+  /*
+   * we can do this before linking hte inode bc the split_at would
+   * be a no-op.. we have no children (namely open snaprealms) to
+   * divy up
+   */
+  in->decode_snap_blob(snapbl);
 }
 
 // EMetaBlob::remotebit