From d90cc26b11374552fdafd70c36a360efee6cc7f0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 23 Jul 2015 16:28:36 -0400 Subject: [PATCH] osd: add and use operator<< for BackfillInterval Signed-off-by: Sage Weil --- src/osd/PG.cc | 10 ++++++++++ src/osd/PG.h | 6 ++++-- src/osd/ReplicatedPG.cc | 8 ++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 848a63a6f27..be9a5489d2b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -7685,6 +7685,16 @@ void PG::RecoveryState::end_handle() { orig_ctx = NULL; } +ostream& operator<<(ostream& out, const PG::BackfillInterval& bi) +{ + out << "BackfillInfo(" << bi.begin << "-" << bi.end + << " " << bi.objects.size() << " objects"; + if (!bi.objects.empty()) + out << " " << bi.objects; + out << ")"; + return out; +} + void intrusive_ptr_add_ref(PG *pg) { pg->get("intptr"); } void intrusive_ptr_release(PG *pg) { pg->put("intptr"); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 5df74b07e73..e907ac7dda6 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -640,7 +640,6 @@ public: set heartbeat_peers; set probe_targets; -protected: /** * BackfillInterval * @@ -717,7 +716,8 @@ protected: f->close_section(); } }; - + +protected: BackfillInterval backfill_info; map peer_backfill_info; bool backfill_reserved; @@ -2295,4 +2295,6 @@ public: ostream& operator<<(ostream& out, const PG& pg); +ostream& operator<<(ostream& out, const PG::BackfillInterval& bi); + #endif diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8fcecd5af9f..26d094c15de 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -9701,10 +9701,7 @@ int ReplicatedPG::recover_backfill( backfill_pos = MIN_HOBJ(backfill_info.begin, earliest_peer_backfill(), get_sort_bitwise()); - dout(20) << " my backfill interval " << backfill_info.begin << "-" << backfill_info.end - << " " << backfill_info.objects.size() << " objects" - << " " << backfill_info.objects - << dendl; + dout(20) << " my backfill interval " << backfill_info << dendl; bool sent_scan = false; for (set::iterator i = backfill_targets.begin(); @@ -9713,8 +9710,7 @@ int ReplicatedPG::recover_backfill( pg_shard_t bt = *i; BackfillInterval& pbi = peer_backfill_info[bt]; - dout(20) << " peer shard " << bt << " backfill " << pbi.begin << "-" - << pbi.end << " " << pbi.objects << dendl; + dout(20) << " peer shard " << bt << " backfill " << pbi << dendl; if (cmp(pbi.begin, backfill_info.begin, get_sort_bitwise()) <= 0 && !pbi.extends_to_end() && pbi.empty()) { dout(10) << " scanning peer osd." << bt << " from " << pbi.end << dendl; -- 2.47.3