]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrubber/pg_scrubber: remove m_needs_sleep
authorSamuel Just <sjust@redhat.com>
Fri, 17 Feb 2023 07:20:57 +0000 (23:20 -0800)
committerRonen Friedman <rfriedma@redhat.com>
Wed, 26 Mar 2025 16:02:39 +0000 (16:02 +0000)
It doesn't appear to be possible to invoke add_delayed_scheduling
again prior to the timer callback being called.  Simply sleeping
unconditionally should have the same behavior.

Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit b1a89b0f4e65b6086d1e182b7c3f3b24582fa57b)

src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/pg_scrubber.h

index b268ab103e5e3f3758a41c0484af190ebe4510b1..2b79f1bb99b033c11c1207324a813311d52878ff 100644 (file)
@@ -422,7 +422,6 @@ void PgScrubber::reset_epoch(epoch_t epoch_queued)
   m_fsm->assert_not_active();
 
   m_epoch_start = epoch_queued;
-  m_needs_sleep = true;
   ceph_assert(m_is_deep == state_test(PG_STATE_DEEP_SCRUB));
   update_op_mode_text();
 }
@@ -890,17 +889,13 @@ void PgScrubber::add_delayed_scheduling()
   m_end = m_start;  // not blocking any range now
 
   milliseconds sleep_time{0ms};
-  if (m_needs_sleep) {
     sleep_time = m_osds->get_scrub_services().scrub_sleep_time(
       m_flags.required);
-  }
-  dout(15) << __func__ << " sleep: " << sleep_time.count() << "ms. needed? "
-          << m_needs_sleep << dendl;
+  dout(15) << __func__ << " sleep: " << sleep_time.count() << "ms." << dendl;
 
   if (sleep_time.count()) {
     // schedule a transition for some 'sleep_time' ms in the future
 
-    m_needs_sleep = false;
     m_sleep_started_at = ceph_clock_now();
 
     // the following log line is used by osd-scrub-test.sh
@@ -919,7 +914,6 @@ void PgScrubber::add_delayed_scheduling()
          << dendl;
        return;
       }
-      scrbr->m_needs_sleep = true;
       lgeneric_dout(scrbr->get_pg_cct(), 7)
        << "scrub_requeue_callback: slept for "
        << ceph_clock_now() - scrbr->m_sleep_started_at << ", re-queuing scrub"
@@ -2441,7 +2435,6 @@ void PgScrubber::reset_internal_state()
   m_primary_scrubmap_pos.reset();
   replica_scrubmap = ScrubMap{};
   replica_scrubmap_pos.reset();
-  m_needs_sleep = true;
   m_sleep_started_at = utime_t{};
 
   m_active = false;
index ce9ac9c96f064a696ed2fd22989a3188f958e99e..55bb355f84502ab555709183d4b6a02f20765263 100644 (file)
@@ -733,10 +733,6 @@ class PgScrubber : public ScrubPgIF,
 
   epoch_t m_last_aborted{};  // last time we've noticed a request to abort
 
-  bool m_needs_sleep{true};  ///< should we sleep before being rescheduled?
-                            ///< always 'true', unless we just got out of a
-                            ///< sleep period
-
   utime_t m_sleep_started_at;