]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs: make cephfs-data-scan prints the max used ino 23543/head
authorYan, Zheng <zyan@redhat.com>
Mon, 13 Aug 2018 01:56:04 +0000 (09:56 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 13 Aug 2018 02:37:21 +0000 (10:37 +0800)
Fixes: http://tracker.ceph.com/issues/26925
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
doc/cephfs/disaster-recovery-experts.rst
src/tools/cephfs/DataScan.cc

index 23dd6138c0b04034a966d288c94f641b701a76e3..8db85a88611f02a6d184089046dd615f5d142f5c 100644 (file)
@@ -183,6 +183,14 @@ The example below shows how to run 4 workers simultaneously:
 It is **important** to ensure that all workers have completed the
 scan_extents phase before any workers enter the scan_inodes phase.
 
+Output of 'scan_links' command includes max used inode number for each
+MDS rank. You may need to update InoTables of each MDS rank.
+
+::
+    cephfs-table-tool recovery-fs:x show inode
+    cephfs-table-tool recovery-fs:x take_inos <max ino of mds.x)
+
+
 After completing the metadata recovery, you may want to run cleanup
 operation to delete ancillary data geneated during recovery.
 
index 3a4babd27dd58fbfcdfd1b39bdb5dd45ecc55dd0..bd8f2c29960fb555c5d38220dd37790d713ac010 100644 (file)
@@ -903,7 +903,7 @@ int DataScan::scan_links()
     return -EINVAL;
   }
 
-  interval_set<inodeno_t> used_inos;
+  interval_set<uint64_t> used_inos;
   map<inodeno_t, int> remote_links;
 
   struct link_info_t {
@@ -1035,6 +1035,28 @@ int DataScan::scan_links()
       }
     }
   }
+
+  map<unsigned, uint64_t> max_ino_map;
+  {
+    auto prev_max_ino = (uint64_t)1 << 40;
+    for (auto p = used_inos.begin(); p != used_inos.end(); ++p) {
+      auto cur_max = p.get_start() + p.get_len() - 1;
+      if (cur_max < prev_max_ino)
+       continue; // system inodes
+
+      if ((prev_max_ino >> 40)  != (cur_max >> 40)) {
+       unsigned rank = (prev_max_ino >> 40) - 1;
+       max_ino_map[rank] = prev_max_ino;
+      } else if ((p.get_start() >> 40) != (cur_max >> 40)) {
+       unsigned rank = (p.get_start() >> 40) - 1;
+       max_ino_map[rank] = ((uint64_t)(rank + 2) << 40) - 1;
+      }
+      prev_max_ino = cur_max;
+    }
+    unsigned rank = (prev_max_ino >> 40) - 1;
+    max_ino_map[rank] = prev_max_ino;
+  }
+
   used_inos.clear();
 
   for (auto& p : dup_primaries) {
@@ -1109,6 +1131,10 @@ int DataScan::scan_links()
       return r;
   }
 
+  for (auto& p : max_ino_map) {
+    std::cout << "mds." << p.first << " max used ino " << p.second << std::endl;
+  }
+
   return 0;
 }