]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrub: base queue priority on the urgency of the scrub target
authorRonen Friedman <rfriedma@redhat.com>
Sun, 8 Sep 2024 10:32:36 +0000 (05:32 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Mon, 9 Sep 2024 06:43:42 +0000 (01:43 -0500)
instead of querying 'planned scrub' flags.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/scrub_job.cc
src/osd/scrubber/scrub_job.h

index b5081f56aba3e8bc87ab8e046d0a04df228412f7..0176a9d59c92ef01e887db977fcc5fe4cc02bd33 100644 (file)
@@ -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.
index 7b05eea39419a30fc31da1237d3ec3843cae759c..6521b6efa99d04cb82d2bd760c84a139cc0b63d0 100644 (file)
@@ -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;
+}
index b037084db6b5df3b3394a6bf6ac62d7d5662d911..2020333cce9b2bff6b0b4c3ce1f1405c366d3aef 100644 (file)
@@ -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