From: David Zafman Date: Sat, 16 Nov 2013 01:25:54 +0000 (-0800) Subject: osd: Change waiting_on_backfill to a set X-Git-Tag: v0.77~23^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0940d8fa6c7b901c24bcb1add6be3e9996a3fb40;p=ceph.git osd: Change waiting_on_backfill to a set Signed-off-by: David Zafman --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 35806a00b9f3..acda31487f99 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -162,7 +162,6 @@ PG::PG(OSDService *o, OSDMapRef curmap, coll(p), pg_log(cct), log_oid(loid), biginfo_oid(ioid), recovery_item(this), scrub_item(this), scrub_finalize_item(this), snap_trim_item(this), stat_queue_item(this), recovery_ops_active(0), - waiting_on_backfill(0), role(0), state(0), send_notify(false), @@ -520,7 +519,7 @@ bool PG::needs_backfill() const bool ret = false; // We can assume that only possible osds that need backfill - // are on the backfill_targets vector. + // are on the backfill_targets vector nodes. vector::const_iterator end = backfill_targets.end(); vector::const_iterator a = backfill_targets.begin(); for (; a != end; ++a) { @@ -1788,7 +1787,7 @@ void PG::clear_recovery_state() backfill_targets.clear(); backfill_info.clear(); peer_backfill_info.clear(); - waiting_on_backfill = false; + waiting_on_backfill.clear(); _clear_recovery_state(); // pg impl specific hook } diff --git a/src/osd/PG.h b/src/osd/PG.h index ae827dd430e0..b96019c1c9ad 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -313,7 +313,7 @@ public: * (if they have one) */ xlist::item recovery_item, scrub_item, scrub_finalize_item, snap_trim_item, stat_queue_item; int recovery_ops_active; - bool waiting_on_backfill; + set waiting_on_backfill; #ifdef DEBUG_RECOVERY_OIDS set recovering_oids; #endif diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 64d655336d4d..6f98dace31ea 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1844,6 +1844,7 @@ void ReplicatedPG::do_scan( int from = m->get_source().num(); //XXX: Check that from is in backfill_targets vector //assert(from == get_backfill_target()); + //XXX: Store per "from" peer BackfillInterval& bi = peer_backfill_info; bi.begin = m->begin; bi.end = m->end; @@ -1864,8 +1865,9 @@ void ReplicatedPG::do_scan( } } - assert(waiting_on_backfill); - waiting_on_backfill = false; + assert(waiting_on_backfill.find(from) != waiting_on_backfill.end()); + waiting_on_backfill.erase(from); + //XXX: Should we wait for waiting_on_backfill == 0? finish_recovery_op(bi.begin); } break; @@ -8342,7 +8344,7 @@ bool ReplicatedPG::start_recovery_ops( state_test(PG_STATE_BACKFILL) && !backfill_targets.empty() && started < max && missing.num_missing() == 0 && - !waiting_on_backfill) { + waiting_on_backfill.find(backfill_targets[0]) == waiting_on_backfill.end()) { if (get_osdmap()->test_flag(CEPH_OSDMAP_NOBACKFILL)) { dout(10) << "deferring backfill due to NOBACKFILL" << dendl; deferred_backfill = true; @@ -8809,7 +8811,8 @@ int ReplicatedPG::recover_backfill( MOSDPGScan *m = new MOSDPGScan(MOSDPGScan::OP_SCAN_GET_DIGEST, e, e, info.pgid, pbi.end, hobject_t()); osd->send_message_osd_cluster(backfill_targets[0], m, get_osdmap()->get_epoch()); - waiting_on_backfill = true; + assert(waiting_on_backfill.find(backfill_targets[0]) == waiting_on_backfill.end()); + waiting_on_backfill.insert(backfill_targets[0]); start_recovery_op(pbi.end); ops++; break; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index a9631128aec9..67851138cf35 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -702,7 +702,11 @@ protected: p != backfill_targets.end(); ++p) f->dump_int("osd", *p); f->close_section(); - f->dump_int("waiting_on_backfill", waiting_on_backfill); + f->open_array_section("waiting_on_backfill"); + for (set::const_iterator p = waiting_on_backfill.begin(); + p != waiting_on_backfill.end(); ++p) + f->dump_int("osd", *p); + f->close_section(); f->dump_stream("last_backfill_started") << last_backfill_started; { f->open_object_section("backfill_info");