diff options
Diffstat (limited to 'src/osd/PG.cc')
-rw-r--r-- | src/osd/PG.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3d02bab0580..ae28ad704d1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -605,24 +605,22 @@ void PG::merge_from(map<spg_t,PGRef>& sources, PeeringCtx &rctx, snap_mapper.update_bits(split_bits); } -void PG::add_backoff(SessionRef s, const hobject_t& begin, const hobject_t& end) +void PG::add_backoff(const ceph::ref_t<Session>& s, const hobject_t& begin, const hobject_t& end) { - ConnectionRef con = s->con; + auto con = s->con; if (!con) // OSD::ms_handle_reset clears s->con without a lock return; - BackoffRef b(s->have_backoff(info.pgid, begin)); + auto b = s->have_backoff(info.pgid, begin); if (b) { derr << __func__ << " already have backoff for " << s << " begin " << begin << " " << *b << dendl; ceph_abort(); } std::lock_guard l(backoff_lock); - { - b = new Backoff(info.pgid, this, s, ++s->backoff_seq, begin, end); - backoffs[begin].insert(b); - s->add_backoff(b); - dout(10) << __func__ << " session " << s << " added " << *b << dendl; - } + b = ceph::make_ref<Backoff>(info.pgid, this, s, ++s->backoff_seq, begin, end); + backoffs[begin].insert(b); + s->add_backoff(b); + dout(10) << __func__ << " session " << s << " added " << *b << dendl; con->send_message( new MOSDBackoff( info.pgid, @@ -636,7 +634,7 @@ void PG::add_backoff(SessionRef s, const hobject_t& begin, const hobject_t& end) void PG::release_backoffs(const hobject_t& begin, const hobject_t& end) { dout(10) << __func__ << " [" << begin << "," << end << ")" << dendl; - vector<BackoffRef> bv; + vector<ceph::ref_t<Backoff>> bv; { std::lock_guard l(backoff_lock); auto p = backoffs.lower_bound(begin); @@ -698,7 +696,7 @@ void PG::release_backoffs(const hobject_t& begin, const hobject_t& end) void PG::clear_backoffs() { dout(10) << __func__ << " " << dendl; - map<hobject_t,set<BackoffRef>> ls; + map<hobject_t,set<ceph::ref_t<Backoff>>> ls; { std::lock_guard l(backoff_lock); ls.swap(backoffs); @@ -722,7 +720,7 @@ void PG::clear_backoffs() } // called by Session::clear_backoffs() -void PG::rm_backoff(BackoffRef b) +void PG::rm_backoff(const ceph::ref_t<Backoff>& b) { dout(10) << __func__ << " " << *b << dendl; std::lock_guard l(backoff_lock); |