From 6524f8bb4a43ce2cd1b4e06e384de0bc522e2dc1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Feb 2016 14:22:04 -0500 Subject: [PATCH] osd/PG: only set split child last_backfill if within PG range 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 --- src/osd/PG.cc | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 8d5cbc3db3ec..bb915c09c30d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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; -- 2.47.3