]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::scrub: use register_on_commit rather than on_finish
authorSamuel Just <sjust@redhat.com>
Fri, 13 Nov 2015 22:06:57 +0000 (14:06 -0800)
committerSamuel Just <sjust@redhat.com>
Thu, 25 Feb 2016 18:56:40 +0000 (10:56 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 9ac783929972ac44dad347a93aef03c426e216aa..74efe97dd3555d1e232ffb784c71705da264f102 100644 (file)
@@ -12214,22 +12214,6 @@ bool ReplicatedPG::_range_available_for_scrub(
   return true;
 }
 
-struct C_ScrubDigestUpdated : public Context {
-  ReplicatedPGRef pg;
-  explicit C_ScrubDigestUpdated(ReplicatedPG *pg) : pg(pg) {}
-  void finish(int r) {
-    pg->_scrub_digest_updated();
-  }
-};
-
-void ReplicatedPG::_scrub_digest_updated()
-{
-  dout(20) << __func__ << dendl;
-  if (--scrubber.num_digest_updates_pending == 0) {
-    requeue_scrub();
-  }
-}
-
 static bool doing_clones(const boost::optional<SnapSet> &snapset,
                         const vector<snapid_t>::reverse_iterator &curclone) {
     return snapset && curclone != snapset.get().clones.rend();
@@ -12615,7 +12599,15 @@ void ReplicatedPG::_scrub(
     ctx->new_obs.oi.set_data_digest(p->second.first);
     ctx->new_obs.oi.set_omap_digest(p->second.second);
     finish_ctx(ctx.get(), pg_log_entry_t::MODIFY, true, true);
-    ctx->on_finish = new C_ScrubDigestUpdated(this);
+
+    ctx->register_on_success(
+      [this]() {
+       dout(20) << "updating scrub digest" << dendl;
+       if (--scrubber.num_digest_updates_pending == 0) {
+         requeue_scrub();
+       }
+      });
+
     simple_opc_submit(std::move(ctx));
     ++scrubber.num_digest_updates_pending;
   }
index d51fe7060333701e9fb581d5adb258b2f0760e94..f4560a6521089b22e8cfb4df0a8e55b4dc388c13 100644 (file)
@@ -1449,7 +1449,6 @@ protected:
   virtual void _scrub(
     ScrubMap &map,
     const std::map<hobject_t, pair<uint32_t, uint32_t>, hobject_t::BitwiseComparator> &missing_digest);
-  void _scrub_digest_updated();
   virtual void _scrub_clear_state();
   virtual void _scrub_finish();
   object_stat_collection_t scrub_cstat;