]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Use boost::optional instead of snap 0 for "all_clones"
authorDavid Zafman <dzafman@redhat.com>
Mon, 26 Oct 2015 18:36:43 +0000 (11:36 -0700)
committerDavid Zafman <dzafman@redhat.com>
Thu, 25 Feb 2016 20:50:26 +0000 (12:50 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 310bf784b7cd8d75f2ab7ee431bc764f5b312aa2)

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 93a077ba91e40e2992748adab3ebba4a6d64cb8d..3c6511f66bb2af116cdf66134ff085c3331e8333 100644 (file)
@@ -11271,7 +11271,7 @@ unsigned ReplicatedPG::process_clones_to(const boost::optional<hobject_t> &head,
   const spg_t &pgid,
   const char *mode,
   bool allow_incomplete_clones,
-  snapid_t target,
+  boost::optional<snapid_t> target,
   vector<snapid_t>::reverse_iterator *curclone)
 {
   assert(head);
@@ -11280,7 +11280,7 @@ unsigned ReplicatedPG::process_clones_to(const boost::optional<hobject_t> &head,
 
   // NOTE: clones are in descending order, thus **curclone > target test here
   hobject_t next_clone(head.get());
-  while(doing_clones(snapset, *curclone) && **curclone > target) {
+  while(doing_clones(snapset, *curclone) && (!target || **curclone > *target)) {
     ++missing;
     // it is okay to be missing one or more clones in a cache tier.
     // skip higher-numbered clones in the list.
@@ -11331,7 +11331,7 @@ void ReplicatedPG::_scrub(
   bool repair = state_test(PG_STATE_REPAIR);
   bool deep_scrub = state_test(PG_STATE_DEEP_SCRUB);
   const char *mode = (repair ? "repair": (deep_scrub ? "deep-scrub" : "scrub"));
-  const snapid_t all_clones = 0;
+  boost::optional<snapid_t> all_clones;   // Unspecified snapid_t or boost::none
 
   // traverse in reverse order.
   boost::optional<hobject_t> head;
@@ -11410,7 +11410,7 @@ void ReplicatedPG::_scrub(
 
     // Check for any problems while processing clones
     if (doing_clones(snapset, curclone)) {
-      snapid_t target;
+      boost::optional<snapid_t> target;
       // Expecting an object with snap for current head
       if (soid.has_snapset() || soid.get_head() != head->get_head()) {
 
index d2dc3049950751f234bfc7631a251026b9d2bca0..c8ed4fc2c909b92e3d19f15135c3effc629799c3 100644 (file)
@@ -1434,7 +1434,7 @@ private:
     const spg_t &pgid,
     const char *mode,
     bool allow_incomplete_clones,
-    snapid_t target,
+    boost::optional<snapid_t> target,
     vector<snapid_t>::reverse_iterator *curclone);
 
 public: