]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add damage_flags_t to inode+frag
authorJohn Spray <john.spray@redhat.com>
Mon, 22 Jun 2015 15:05:35 +0000 (16:05 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 13 Jul 2015 13:05:16 +0000 (14:05 +0100)
Used to mark inodes+fnodes with flags indicating
that particular types of damage have either
been detected (scrub/fetch) or caused (cephfs-data-scan
inject).

This should serve as a cue to the MDS to do online
repair of stats for the nodes that have been injected.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/mdstypes.cc
src/mds/mdstypes.h

index 58ebf3f9664301daedec71a8da0b333e10e395ca..858076a98cfb52dcbbcd9e8f3fef1f257e0ccd38 100644 (file)
@@ -1284,11 +1284,12 @@ void InodeStoreBase::encode_bare(bufferlist &bl, const bufferlist *snap_blob) co
     ::encode(bufferlist(), bl);
   ::encode(old_inodes, bl);
   ::encode(oldest_snap, bl);
+  ::encode(damage_flags, bl);
 }
 
 void InodeStoreBase::encode(bufferlist &bl, const bufferlist *snap_blob) const
 {
-  ENCODE_START(5, 4, bl);
+  ENCODE_START(6, 4, bl);
   encode_bare(bl, snap_blob);
   ENCODE_FINISH(bl);
 }
@@ -1319,8 +1320,18 @@ void InodeStoreBase::decode_bare(bufferlist::iterator &bl,
       ::decode(inode.layout, bl); // but we only care about the layout portion
     }
   }
-  if (struct_v >= 5 && !bl.end())
-    ::decode(oldest_snap, bl);
+
+  if (struct_v >= 5) {
+    // InodeStore is embedded in dentries without proper versioning, so
+    // we consume up to the end of the buffer
+    if (!bl.end()) {
+      ::decode(oldest_snap, bl);
+    }
+
+    if (!bl.end()) {
+      ::decode(damage_flags, bl);
+    }
+  }
 }
 
 
index 8b7a38db83f81ad088b9099386124cf89cd5449a..586ad3091d1015a6706a6bb7877161848940d896 100644 (file)
@@ -78,6 +78,7 @@ public:
   fragtree_t                 dirfragtree;  // dir frag tree, if any.  always consistent with our dirfrag map.
   compact_map<snapid_t, old_inode_t> old_inodes;   // key = last, value.first = first
   snapid_t                  oldest_snap;
+  damage_flags_t            damage_flags;
 
   InodeStoreBase() : oldest_snap(CEPH_NOSNAP) { }
 
index 370b11671e97a02ad3b65044620d8143ac3d909a..7a54915b379c6b17eb55a78cb0d14b912bc528b1 100644 (file)
@@ -551,25 +551,29 @@ void old_inode_t::generate_test_instances(list<old_inode_t*>& ls)
  */
 void fnode_t::encode(bufferlist &bl) const
 {
-  ENCODE_START(2, 2, bl);
+  ENCODE_START(3, 2, bl);
   ::encode(version, bl);
   ::encode(snap_purged_thru, bl);
   ::encode(fragstat, bl);
   ::encode(accounted_fragstat, bl);
   ::encode(rstat, bl);
   ::encode(accounted_rstat, bl);
+  ::encode(damage_flags, bl);
   ENCODE_FINISH(bl);
 }
 
 void fnode_t::decode(bufferlist::iterator &bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
   ::decode(version, bl);
   ::decode(snap_purged_thru, bl);
   ::decode(fragstat, bl);
   ::decode(accounted_fragstat, bl);
   ::decode(rstat, bl);
   ::decode(accounted_rstat, bl);
+  if (struct_v >= 3) {
+    ::decode(damage_flags, bl);
+  }
   DECODE_FINISH(bl);
 }
 
index 55fd69eeb26898004c9d687575abd8ad9568e190..fbba7887d73deb4b39ffc8b1d26c65fbc10dcd81 100644 (file)
@@ -405,6 +405,13 @@ public:
 };
 WRITE_CLASS_ENCODER(inline_data_t)
 
+enum {
+  DAMAGE_STATS,     // statistics (dirstat, size, etc)
+  DAMAGE_RSTATS,    // recursive statistics (rstat, accounted_rstat)
+  DAMAGE_FRAGTREE   // fragtree -- repair by searching
+};
+typedef uint32_t damage_flags_t;
+
 /*
  * inode_t
  */
@@ -599,6 +606,7 @@ struct fnode_t {
   snapid_t snap_purged_thru;   // the max_last_destroy snapid we've been purged thru
   frag_info_t fragstat, accounted_fragstat;
   nest_info_t rstat, accounted_rstat;
+  damage_flags_t damage_flags;
 
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator& bl);