From: Sage Weil Date: Wed, 1 Feb 2017 22:27:32 +0000 (-0500) Subject: osd: split backoffs on PG split X-Git-Tag: v12.0.1~441^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9cef8e4e4a11f6815af25b0f35ab16e8f56c1bef;p=ceph.git osd: split backoffs on PG split Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index aaccffb521cb..d8c7ab93582d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2308,6 +2308,12 @@ void PG::split_into(pg_t child_pgid, PG *child, unsigned split_bits) split_ops(child, split_bits); _split_into(child_pgid, child, split_bits); + // release all backoffs so that Objecter doesn't need to handle unblock + // on split backoffs + release_backoffs(hobject_t(), hobject_t::get_max()); + // split any remaining (deleting) backoffs among child PGs + split_backoffs(child, split_bits); + child->on_new_interval(); child->dirty_info = true; @@ -2411,6 +2417,71 @@ void PG::release_backoffs(const hobject_t& begin, const hobject_t& end) } } +void PG::split_backoffs(PG *child, unsigned split_bits) +{ + dout(10) << __func__ << " split_bits " << split_bits << " child " + << child->info.pgid.pgid << dendl; + unsigned mask = ~((~0)< backoffs_to_dup; // pg backoffs + vector backoffs_to_move; // oid backoffs + { + Mutex::Locker l(backoff_lock); + auto p = backoffs.begin(); + while (p != backoffs.end()) { + if (p->first == info.pgid.pgid.get_hobj_start()) { + // if it is a full PG we always dup it for the child. + for (auto& q : p->second) { + dout(10) << __func__ << " pg backoff " << p->first + << " " << q << dendl; + backoffs_to_dup.push_back(q); + } + } else { + // otherwise, we move it to the child only if falls into the + // childs hash range. + if ((p->first.get_hash() & mask) == child->info.pgid.pgid.ps()) { + for (auto& q : p->second) { + dout(20) << __func__ << " will move " << p->first + << " " << q << dendl; + backoffs_to_move.push_back(q); + } + p = backoffs.erase(p); + continue; + } else { + dout(20) << __func__ << " will not move " << p->first + << " " << p->second << dendl; + } + } + ++p; + } + } + for (auto b : backoffs_to_dup) { + SessionRef s; + { + Mutex::Locker l(b->lock); + b->end = info.pgid.pgid.get_hobj_end(split_bits); + dout(10) << __func__ << " pg backoff " << *b << dendl; + s = b->session; + } + if (s) { + child->add_pg_backoff(b->session); + } else { + dout(20) << __func__ << " didn't dup pg backoff, session is null" + << dendl; + } + } + for (auto b : backoffs_to_move) { + Mutex::Locker l(b->lock); + if (b->pg == this) { + dout(10) << __func__ << " move backoff " << *b << " to child" << dendl; + b->pg = child; + child->backoffs[b->begin].insert(b); + } else { + dout(20) << __func__ << " move backoff " << *b << " nowhere... pg is null" + << dendl; + } + } +} + void PG::clear_backoffs() { dout(10) << __func__ << " " << dendl; diff --git a/src/osd/PG.h b/src/osd/PG.h index 216195ff8af4..07a674df79b4 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1094,6 +1094,7 @@ public: release_backoffs(o, o); } void clear_backoffs(); + void split_backoffs(PG *child, unsigned split_bits); void add_pg_backoff(SessionRef s) { hobject_t begin = info.pgid.pgid.get_hobj_start();