]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: fix reserve_local()
authorRonen Friedman <rfriedma@redhat.com>
Sun, 28 Jul 2024 10:20:38 +0000 (05:20 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sun, 25 Aug 2024 13:01:00 +0000 (08:01 -0500)
to use the correct method when determining whether we should
perform the reservation.

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

index f31954df3ebb7befa14166f5d8a3d157fbd6120e..c29b560a2f6505107553a8224056f2ee0ad76e7d 100644 (file)
@@ -723,16 +723,9 @@ void PgScrubber::request_rescrubbing(requested_scrub_t& request_flags)
  * a wrapper around the actual reservation, and that object releases
  * the local resource automatically when reset.
  */
-bool PgScrubber::reserve_local()
-{
-  // Implementation note re the 'is high priority' parameter:
-  // In this step in the scrub scheduling rework, at the point of the call to
-  // this function, set_op_params() was not yet called, and we cannot rely
-  // on m_is_deep to determine the scrub level. So for now - we check both
-  // targets here.
-  const bool is_hp =
-      m_scrub_job->is_job_high_priority(scrub_level_t::shallow) ||
-      m_scrub_job->is_job_high_priority(scrub_level_t::deep);
+bool PgScrubber::reserve_local(const Scrub::SchedTarget& trgt)
+{
+  const bool is_hp = !ScrubJob::observes_max_concurrency(trgt.urgency());
 
   m_local_osd_resource = m_osds->get_scrub_services().inc_scrubs_local(is_hp);
   if (m_local_osd_resource) {
index f2ce4c3000ed55914a2d3f0ca23f49201e62d29b..072b623edafd67fe1c07bc8765aa8bbce064d4ee 100644 (file)
@@ -273,7 +273,7 @@ class PgScrubber : public ScrubPgIF,
    * Fails if OSD's local-scrubs budget was exhausted
    * \returns were local resources reserved?
    */
-  bool reserve_local() final;
+  bool reserve_local(const Scrub::SchedTarget& trgt);
 
   void handle_query_state(ceph::Formatter* f) final;
 
index 7c6c9239730ebe0f9dc4d407112af43f0093e8fd..60cb19a9af2d92922e305234d32ac17a2940caee 100644 (file)
@@ -89,6 +89,8 @@ struct OSDRestrictions {
   bool only_deadlined{false};
   bool load_is_low:1{true};
   bool time_permit:1{true};
+  bool max_concurrency_reached:1{false};
+  bool recovery_in_progress:1{false};
 };
 static_assert(sizeof(Scrub::OSDRestrictions) <= sizeof(uint32_t));
 
@@ -592,16 +594,6 @@ struct ScrubPgIF {
   virtual void update_scrub_stats(
     ceph::coarse_real_clock::time_point now_is) = 0;
 
-  // --------------- reservations -----------------------------------
-
-  /**
-   * Reserve local scrub resources (managed by the OSD)
-   *
-   * Fails if OSD's local-scrubs budget was exhausted
-   * \returns were local resources reserved?
-   */
-  virtual bool reserve_local() = 0;
-
   /**
    * Recalculate scrub (both deep & shallow) schedules
    *
@@ -609,6 +601,9 @@ struct ScrubPgIF {
    */
   virtual void update_scrub_job(Scrub::delay_ready_t delay_ready) = 0;
 
+
+  // --------------- reservations -----------------------------------
+
   /**
    * route incoming replica-reservations requests/responses to the
    * appropriate handler.