]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: only set split child last_backfill if within PG range
authorSage Weil <sage@redhat.com>
Mon, 8 Feb 2016 19:22:04 +0000 (14:22 -0500)
committerSage Weil <sage@redhat.com>
Thu, 10 Mar 2016 21:36:08 +0000 (16:36 -0500)
If last_backfill is within the parent's PG range, set teh child to MIN.
If it's in the child's, the parent is done.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc

index 8d5cbc3db3ecae30ad9c5f3fb2529be6b9a6ecd3..bb915c09c30d53f54f3bef9daf1675c0473a4e81 100644 (file)
@@ -2286,7 +2286,42 @@ void PG::split_into(pg_t child_pgid, PG *child, unsigned split_bits)
   // Info
   child->info.history = info.history;
   child->info.purged_snaps = info.purged_snaps;
-  child->info.set_last_backfill(info.last_backfill, info.last_backfill_bitwise);
+  if (info.last_backfill_bitwise) {
+    // sort order respects pg boundaries
+    if (cmp(info.last_backfill, info.pgid.pgid.get_hobj_end(split_bits),
+           info.last_backfill_bitwise) >= 0) {
+      // parent is done
+      info.set_last_backfill(hobject_t::get_max(), info.last_backfill_bitwise);
+      if (cmp(info.last_backfill, child->info.pgid.pgid.get_hobj_start(),
+             info.last_backfill_bitwise) < 0) {
+       // child hasn't started
+       child->info.set_last_backfill(hobject_t(), info.last_backfill_bitwise);
+      } else if (cmp(info.last_backfill,
+                    child->info.pgid.pgid.get_hobj_end(split_bits),
+                    info.last_backfill_bitwise) < 0) {
+       // child backfilling
+       child->info.set_last_backfill(info.last_backfill,
+                                     info.last_backfill_bitwise);
+      } else {
+       // child done
+        child->info.set_last_backfill(hobject_t::get_max(),
+                                     info.last_backfill_bitwise);
+      }
+    } else {
+      // parent not done; entire child needs to backfill
+      child->info.set_last_backfill(hobject_t(), info.last_backfill_bitwise);
+    }
+  } else {
+    // nibble sort does not respect pg boundaries
+    if (info.last_backfill.is_max()) {
+      child->info.set_last_backfill(hobject_t::get_max(),
+                                   info.last_backfill_bitwise);
+    } else {
+      // restart backfill on parent and child to be safe.
+      info.set_last_backfill(hobject_t(), info.last_backfill_bitwise);
+      child->info.set_last_backfill(hobject_t(), info.last_backfill_bitwise);
+    }
+  }
 
   child->info.stats = info.stats;
   info.stats.stats_invalid = true;