]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Add a flag to ScrubMap to signal check needed
authorBrad Hubbard <bhubbard@redhat.com>
Fri, 13 Oct 2017 05:46:47 +0000 (15:46 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Tue, 24 Oct 2017 07:27:57 +0000 (17:27 +1000)
If we know none of the scrub maps have errors early in
be_large_omap_check() we can return without doing a lot of unnecessary
work.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/osd/ECBackend.cc
src/osd/ECBackend.h
src/osd/PGBackend.cc
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h
src/osd/osd_types.h

index 780bdb676b3316f9f8d207429d535b412a32f4c7..1c81165c3c5697d152132678e48f741f9c1da00e 100644 (file)
@@ -2381,7 +2381,8 @@ void ECBackend::be_deep_scrub(
   const hobject_t &poid,
   uint32_t seed,
   ScrubMap::object &o,
-  ThreadPool::TPHandle &handle) {
+  ThreadPool::TPHandle &handle,
+  ScrubMap* const map) {
   bufferhash h(-1); // we always used -1
   int r;
   uint64_t stride = cct->_conf->osd_deep_scrub_stride;
index 35655e16d9fe7fdc8b39c52ddd20d99a15e8028d..bcae74e06afca33b47d5b3ea599eada5ca269074 100644 (file)
@@ -673,7 +673,8 @@ public:
     const hobject_t &obj,
     uint32_t seed,
     ScrubMap::object &o,
-    ThreadPool::TPHandle &handle) override;
+    ThreadPool::TPHandle &handle,
+    ScrubMap* const map = nullptr) override;
   uint64_t be_get_ondisk_size(uint64_t logical_size) override {
     return sinfo.logical_to_next_chunk_offset(logical_size);
   }
index 9de930365a6f74e7e6fa28e8b5b91841a6103bae..f03d6a15ccb6fbec9ab61540bf0129fab814dc71 100644 (file)
@@ -605,7 +605,7 @@ void PGBackend::be_scan_list(
 
       // calculate the CRC32 on deep scrubs
       if (deep) {
-       be_deep_scrub(*p, seed, o, handle);
+       be_deep_scrub(*p, seed, o, handle, &map);
       }
 
       dout(25) << __func__ << "  " << poid << dendl;
@@ -1104,6 +1104,18 @@ void PGBackend::be_large_omap_check(const map<pg_shard_t,ScrubMap*> &maps,
   int& large_omap_objects,
   ostream &warnstream) const
 {
+  bool needs_check = false;
+  for (const auto& map : maps) {
+    if (map.second->has_large_omap_object_errors) {
+      needs_check = true;
+      break;
+    }
+  }
+
+  if (!needs_check) {
+    return;
+  }
+
   // Iterate through objects and check large omap object flag
   for (const auto& k : master_set) {
     for (const auto& map : maps) {
index 85a42ad284d4692275f2fddd1d294965ec9e550c..8a25d0284a2d3099ad3b7443521d19b431b56a3b 100644 (file)
@@ -590,7 +590,8 @@ typedef ceph::shared_ptr<const OSDMap> OSDMapRef;
      const hobject_t &poid,
      uint32_t seed,
      ScrubMap::object &o,
-     ThreadPool::TPHandle &handle) = 0;
+     ThreadPool::TPHandle &handle,
+     ScrubMap* const map = nullptr) = 0;
    void be_large_omap_check(
      const map<pg_shard_t,ScrubMap*> &maps,
      const set<hobject_t> &master_set,
index 7f41687c7d4baee50abe27cfcfdc0b845ffda971..9c3a7344a6e65bd9035db1f219c4d78285515088 100644 (file)
@@ -695,7 +695,8 @@ void ReplicatedBackend::be_deep_scrub(
   const hobject_t &poid,
   uint32_t seed,
   ScrubMap::object &o,
-  ThreadPool::TPHandle &handle)
+  ThreadPool::TPHandle &handle,
+  ScrubMap* const map)
 {
   dout(10) << __func__ << " " << poid << " seed " 
           << std::hex << seed << std::dec << dendl;
@@ -798,6 +799,7 @@ void ReplicatedBackend::be_deep_scrub(
     o.large_omap_object_found = true;
     o.large_omap_object_key_count = keys_scanned;
     o.large_omap_object_value_size = value_sum;
+    map->has_large_omap_object_errors = true;
   }
 
   if (iter->status() < 0) {
index 3891e0fe2a34190168c5ac08e1070de525c65ae5..249b056ff238210711e4fc4daac513dac154b366 100644 (file)
@@ -433,7 +433,8 @@ private:
     const hobject_t &obj,
     uint32_t seed,
     ScrubMap::object &o,
-    ThreadPool::TPHandle &handle) override;
+    ThreadPool::TPHandle &handle,
+    ScrubMap* const map = nullptr) override;
   uint64_t be_get_ondisk_size(uint64_t logical_size) override { return logical_size; }
 };
 
index 7683991ab57dba93899b812057879fa4165119b9..34759442b7bc2e6ed04cba8da1bd5d8bee3f3b90 100644 (file)
@@ -4895,6 +4895,7 @@ struct ScrubMap {
   map<hobject_t,object> objects;
   eversion_t valid_through;
   eversion_t incr_since;
+  bool has_large_omap_object_errors:1;
 
   void merge_incr(const ScrubMap &l);
   void insert(const ScrubMap &r) {