@@ -94,7 +94,7 @@ void ScrubQueue::register_with_osd(
9494 switch (state_at_entry) {
9595 case qu_state_t ::registered:
9696 // just updating the schedule?
97- update_job (scrub_job, suggested);
97+ update_job (scrub_job, suggested, false /* keep n.b. delay */ );
9898 break ;
9999
100100 case qu_state_t ::not_registered:
@@ -110,7 +110,7 @@ void ScrubQueue::register_with_osd(
110110 break ;
111111 }
112112
113- update_job (scrub_job, suggested);
113+ update_job (scrub_job, suggested, true /* resets not_before */ );
114114 to_scrub.push_back (scrub_job);
115115 scrub_job->in_queues = true ;
116116 scrub_job->state = qu_state_t ::registered;
@@ -124,7 +124,7 @@ void ScrubQueue::register_with_osd(
124124 // at any minute
125125 std::lock_guard lck{jobs_lock};
126126
127- update_job (scrub_job, suggested);
127+ update_job (scrub_job, suggested, true /* resets not_before */ );
128128 if (scrub_job->state == qu_state_t ::not_registered) {
129129 dout (5 ) << " scrub job state changed to 'not registered'" << dendl;
130130 to_scrub.push_back (scrub_job);
@@ -138,18 +138,19 @@ void ScrubQueue::register_with_osd(
138138 dout (10 ) << fmt::format (
139139 " pg[{}] sched-state changed from <{:.14}> to <{:.14}> (@{:s})" ,
140140 scrub_job->pgid , state_at_entry, scrub_job->state .load (),
141- scrub_job->schedule .scheduled_at )
141+ scrub_job->schedule .not_before )
142142 << dendl;
143143}
144144
145- // look mommy - no locks!
145+
146146void ScrubQueue::update_job (Scrub::ScrubJobRef scrub_job,
147- const sched_params_t & suggested)
147+ const sched_params_t & suggested,
148+ bool reset_nb)
148149{
149150 // adjust the suggested scrub time according to OSD-wide status
150151 auto adjusted = adjust_target_time (suggested);
151- scrub_job->update_schedule (adjusted);
152152 scrub_job->high_priority = suggested.is_must == must_scrub_t ::mandatory;
153+ scrub_job->update_schedule (adjusted, reset_nb);
153154}
154155
155156sched_params_t ScrubQueue::determine_scrub_time (
@@ -262,7 +263,7 @@ ScrubQContainer ScrubQueue::collect_ripe_jobs(
262263 utime_t time_now)
263264{
264265 auto filtr = [time_now, rst = restrictions](const auto & jobref) -> bool {
265- return jobref->schedule .scheduled_at <= time_now &&
266+ return jobref->schedule .not_before <= time_now &&
266267 (!rst.high_priority_only || jobref->high_priority ) &&
267268 (!rst.only_deadlined || (!jobref->schedule .deadline .is_zero () &&
268269 jobref->schedule .deadline <= time_now));
@@ -280,7 +281,8 @@ ScrubQContainer ScrubQueue::collect_ripe_jobs(
280281 for (const auto & jobref : group) {
281282 if (!filtr (jobref)) {
282283 dout (20 ) << fmt::format (
283- " not ripe: {} @ {:s}" , jobref->pgid ,
284+ " not ripe: {} @ {:s} ({:s})" , jobref->pgid ,
285+ jobref->schedule .not_before ,
284286 jobref->schedule .scheduled_at )
285287 << dendl;
286288 }
@@ -295,7 +297,7 @@ Scrub::scrub_schedule_t ScrubQueue::adjust_target_time(
295297 const sched_params_t & times) const
296298{
297299 Scrub::scrub_schedule_t sched_n_dead{
298- times.proposed_time , times.proposed_time };
300+ times.proposed_time , times.proposed_time , times. proposed_time };
299301
300302 if (times.is_must == Scrub::must_scrub_t ::not_mandatory) {
301303 // unless explicitly requested, postpone the scrub with a random delay
0 commit comments