Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

OSD: process_peering_event check for new map on each pg

Signed-off-by: Samuel Just <sam.just@inktank.com>
  • Loading branch information...
commit 0ee3d87f4f82cf4c17a63e0cebdf2c0f730d4bc3 1 parent c1f2a80
Samuel Just athanatos authored

Showing 2 changed files with 25 additions and 7 deletions. Show diff stats Hide diff stats

  1. +1 0  src/osd/OSD.cc
  2. +24 7 src/osd/OSD.h
1  src/osd/OSD.cc
@@ -5190,6 +5190,7 @@ void OSD::process_peering_events(const list<PG*> &pgs)
5190 5190 ++i) {
5191 5191 PG *pg = *i;
5192 5192 pg->lock();
  5193 + curmap = service.get_osdmap();
5193 5194 if (pg->deleting) {
5194 5195 pg->unlock();
5195 5196 continue;
31 src/osd/OSD.h
@@ -569,9 +569,11 @@ class OSD : public Dispatcher {
569 569 struct PeeringWQ : public ThreadPool::BatchWorkQueue<PG> {
570 570 list<PG*> peering_queue;
571 571 OSD *osd;
  572 + set<PG*> in_use;
  573 + const size_t batch_size;
572 574 PeeringWQ(OSD *o, time_t ti, ThreadPool *tp, size_t batch_size)
573 575 : ThreadPool::BatchWorkQueue<PG>(
574   - "OSD::PeeringWQ", ti, ti*10, tp, batch_size), osd(o) {}
  576 + "OSD::PeeringWQ", ti, ti*10, tp), osd(o), batch_size(batch_size) {}
575 577
576 578 void _dequeue(PG *pg) {
577 579 for (list<PG*>::iterator i = peering_queue.begin();
@@ -591,12 +593,20 @@ class OSD : public Dispatcher {
591 593 bool _empty() {
592 594 return peering_queue.empty();
593 595 }
594   - PG *_dequeue() {
595   - if (peering_queue.empty())
596   - return 0;
597   - PG *retval = peering_queue.front();
598   - peering_queue.pop_front();
599   - return retval;
  596 + void _dequeue(list<PG*> *out) {
  597 + set<PG*> got;
  598 + for (list<PG*>::iterator i = peering_queue.begin();
  599 + i != peering_queue.end() && out->size() < batch_size;
  600 + ) {
  601 + if (in_use.count(*i)) {
  602 + ++i;
  603 + } else {
  604 + out->push_back(*i);
  605 + got.insert(*i);
  606 + peering_queue.erase(i++);
  607 + }
  608 + }
  609 + in_use.insert(got.begin(), got.end());
600 610 }
601 611 void _process(const list<PG *> &pgs) {
602 612 osd->process_peering_events(pgs);
@@ -606,6 +616,13 @@ class OSD : public Dispatcher {
606 616 (*i)->put();
607 617 }
608 618 }
  619 + void _process_finish(const list<PG *> &pgs) {
  620 + for (list<PG*>::const_iterator i = pgs.begin();
  621 + i != pgs.end();
  622 + ++i) {
  623 + in_use.erase(*i);
  624 + }
  625 + }
609 626 void _clear() {
610 627 assert(peering_queue.empty());
611 628 }

0 comments on commit 0ee3d87

Please sign in to comment.
Something went wrong with that request. Please try again.