void OSD::resched_all_scrubs()
{
dout(10) << __func__ << ": start" << dendl;
- OSDService::ScrubJob scrub;
- if (service.first_scrub_stamp(&scrub)) {
- do {
- dout(20) << __func__ << ": examine " << scrub.pgid << dendl;
-
- PGRef pg = _lookup_lock_pg(scrub.pgid);
+ const vector<spg_t> pgs = [this] {
+ vector<spg_t> pgs;
+ OSDService::ScrubJob job;
+ if (service.first_scrub_stamp(&job)) {
+ do {
+ pgs.push_back(job.pgid);
+ } while (service.next_scrub_stamp(job, &job));
+ }
+ return pgs;
+ }();
+ for (auto& pgid : pgs) {
+ dout(20) << __func__ << ": examine " << pgid << dendl;
+ PGRef pg = _lookup_lock_pg(pgid);
if (!pg)
continue;
if (!pg->scrubber.must_scrub && !pg->scrubber.need_auto) {
- dout(20) << __func__ << ": reschedule " << scrub.pgid << dendl;
+ dout(15) << __func__ << ": reschedule " << pgid << dendl;
pg->on_info_history_change();
}
pg->unlock();
- } while (service.next_scrub_stamp(scrub, &scrub));
}
dout(10) << __func__ << ": done" << dendl;
}
std::lock_guard l(sched_scrub_lock);
if (sched_scrub_pg.empty())
return false;
- set<ScrubJob>::const_iterator iter = sched_scrub_pg.lower_bound(next);
- if (iter == sched_scrub_pg.cend())
- return false;
- ++iter;
+ std::set<ScrubJob>::const_iterator iter = sched_scrub_pg.upper_bound(next);
if (iter == sched_scrub_pg.cend())
return false;
*out = *iter;