Also document scrub scheduling/pending/active states.
Signed-off-by: Sage Weil <sage@newdream.net>
return pg;
}
void _process(PG *pg) {
+
+ // pending -> active
+ pg->lock();
osd->sched_scrub_lock.Lock();
--(osd->scrubs_pending);
assert(osd->scrubs_pending >= 0);
++(osd->scrubs_active);
osd->sched_scrub_lock.Unlock();
+ pg->scrub_reserved = false;
+ pg->scrub_reserved_peers.clear();
+ pg->unlock();
+
pg->scrub();
- pg->get();
- }
- void _process_finish(PG *pg) {
+
+ // active -> nothing.
osd->sched_scrub_lock.Lock();
--(osd->scrubs_active);
osd->sched_scrub_lock.Unlock();
// ==========================================================================================
// SCRUB
+/*
+ * when holding pg and sched_scrub_lock, then the states are:
+ * scheduling:
+ * scrub_reserved = true
+ * osd->scrub_pending++
+ * pending:
+ * scrub_reserved = true
+ * scrub_reserved_peers.size() == acting.size();
+ * pg on scrub_wq
+ * osd->scrub_pending++
+ * scrubbing:
+ * scrub_reserved = false;
+ * osd->scrub_active++
+ */
+
// returns false if waiting for a reply
bool PG::sched_scrub()
{