]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: fsck: only generate 1 error per omap_head
authorSage Weil <sage@redhat.com>
Mon, 5 Aug 2019 17:08:17 +0000 (12:08 -0500)
committerSage Weil <sage@redhat.com>
Thu, 8 Aug 2019 22:26:24 +0000 (17:26 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index c6f90c937193cf5c66edf432f97abfce7a5247cc..fc7640ad5c8b23e89af78c6e3cf28b3c44663400 100644 (file)
@@ -7881,30 +7881,37 @@ int BlueStore::_fsck(bool deep, bool repair)
   dout(1) << __func__ << " checking for stray omap data" << dendl;
   it = db->get_iterator(PREFIX_OMAP);
   if (it) {
+    uint64_t last_omap_head = 0;
     for (it->lower_bound(string()); it->valid(); it->next()) {
       uint64_t omap_head;
       _key_decode_u64(it->key().c_str(), &omap_head);
-      if (used_omap_head.count(omap_head) == 0) {
+      if (used_omap_head.count(omap_head) == 0 &&
+         omap_head != last_omap_head) {
        derr << "fsck error: found stray omap data on omap_head "
             << omap_head << dendl;
        ++errors;
+       last_omap_head = omap_head;
       }
     }
   }
   it = db->get_iterator(PREFIX_PGMETA_OMAP);
   if (it) {
+    uint64_t last_omap_head = 0;
     for (it->lower_bound(string()); it->valid(); it->next()) {
       uint64_t omap_head;
       _key_decode_u64(it->key().c_str(), &omap_head);
-      if (used_pgmeta_omap_head.count(omap_head) == 0) {
+      if (used_pgmeta_omap_head.count(omap_head) == 0 &&
+         omap_head != last_omap_head) {
        derr << "fsck error: found stray (pgmeta) omap data on omap_head "
             << omap_head << dendl;
+       last_omap_head = omap_head;
        ++errors;
       }
     }
   }
   it = db->get_iterator(PREFIX_PERPOOL_OMAP);
   if (it) {
+    uint64_t last_omap_head = 0;
     for (it->lower_bound(string()); it->valid(); it->next()) {
       uint64_t pool;
       uint64_t omap_head;
@@ -7912,10 +7919,12 @@ int BlueStore::_fsck(bool deep, bool repair)
       const char *c = k.c_str();
       c = _key_decode_u64(c, &pool);
       c = _key_decode_u64(c, &omap_head);
-      if (used_per_pool_omap_head.count(omap_head) == 0) {
+      if (used_per_pool_omap_head.count(omap_head) == 0 &&
+         omap_head != last_omap_head) {
        derr << "fsck error: found stray (per-pool) omap data on omap_head "
             << omap_head << dendl;
        ++errors;
+       last_omap_head = omap_head;
       }
     }
   }