From: Ronen Friedman Date: Sun, 8 Sep 2024 10:32:36 +0000 (-0500) Subject: osd/scrub: base queue priority on the urgency of the scrub target X-Git-Tag: testing/wip-pdonnell-testing-20240920.212106-debug~21^2~9 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2e31563389f03776bfa0db9240c07d443972ac44;p=ceph-ci.git osd/scrub: base queue priority on the urgency of the scrub target instead of querying 'planned scrub' flags. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index b5081f56aba..0176a9d59c9 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1698,9 +1698,15 @@ void PgScrubber::set_op_parameters( m_flags.check_repair = m_active_target->urgency() == urgency_t::after_repair; m_flags.auto_repair = false; - m_flags.priority = (request.must_scrub || request.need_auto) - ? get_pg_cct()->_conf->osd_requested_scrub_priority - : m_pg->get_scrub_priority(); + if (ScrubJob::has_high_queue_priority(m_active_target->urgency())) { + // specific high priority scrubs - high queue priority + /// \todo consider - do we really want high queue priority for any scrub? + m_flags.priority = get_pg_cct()->_conf->osd_requested_scrub_priority; + } else { + // regular, low-priority scrubs - low queue priority - unless blocking + // client I/O + m_flags.priority = m_pg->get_scrub_priority(); + } // 'deep-on-error' is set for periodic shallow scrubs, if allowed // by the environment @@ -1722,9 +1728,6 @@ void PgScrubber::set_op_parameters( if (pg_cond.can_autorepair || request.auto_repair) { m_flags.auto_repair = true; } - } else { - ceph_assert(!request.must_deep_scrub); - ceph_assert(!request.need_auto); } // m_is_repair is set for either 'must_repair' or 'repair-on-the-go' (i.e. diff --git a/src/osd/scrubber/scrub_job.cc b/src/osd/scrubber/scrub_job.cc index 7b05eea3941..6521b6efa99 100644 --- a/src/osd/scrubber/scrub_job.cc +++ b/src/osd/scrubber/scrub_job.cc @@ -120,13 +120,7 @@ void ScrubJob::adjust_shallow_schedule( auto& sh_times = shallow_target.sched_info.schedule; // shorthand - if (!ScrubJob::requires_randomization(shallow_target.urgency())) { - // the target time is already set. Make sure to reset the n.b. and - // the (irrelevant) deadline - sh_times.not_before = sh_times.scheduled_at; - sh_times.deadline = sh_times.scheduled_at; - - } else { + if (ScrubJob::requires_randomization(shallow_target.urgency())) { utime_t adj_not_before = last_scrub; utime_t adj_target = last_scrub; sh_times.deadline = adj_target; @@ -152,6 +146,13 @@ void ScrubJob::adjust_shallow_schedule( } sh_times.scheduled_at = adj_target; sh_times.not_before = adj_not_before; + + } else { + + // the target time is already set. Make sure to reset the n.b. and + // the (irrelevant) deadline + sh_times.not_before = sh_times.scheduled_at; + sh_times.deadline = sh_times.scheduled_at; } dout(10) << fmt::format( @@ -429,3 +430,8 @@ bool ScrubJob::observes_recovery(urgency_t urgency) { return urgency < urgency_t::operator_requested; } + +bool ScrubJob::has_high_queue_priority(urgency_t urgency) +{ + return urgency >= urgency_t::operator_requested; +} diff --git a/src/osd/scrubber/scrub_job.h b/src/osd/scrubber/scrub_job.h index b037084db6b..2020333cce9 100644 --- a/src/osd/scrubber/scrub_job.h +++ b/src/osd/scrubber/scrub_job.h @@ -366,6 +366,8 @@ class ScrubJob { static bool observes_random_backoff(urgency_t urgency); static bool observes_recovery(urgency_t urgency); + + static bool has_high_queue_priority(urgency_t urgency); }; } // namespace Scrub