]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerSamuel Just <sjust@redhat.com>
Wed, 22 Feb 2023 02:07:34 +0000 (02:07 +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>
src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/pg_scrubber.h

index 13de8e04ee95a1ca43290f60b5d3eb96143c04f3..8621a462b6ed7fd6b38b72a052960355594a2d61 100644 (file)
@@ -432,7 +432,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();
 }
@@ -864,17 +863,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
@@ -893,7 +888,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"
@@ -2414,7 +2408,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 2e8f51a60dece2a81704709089904956aedc8f7d..d1ab40c4a91424d4328d5b628f03151ce831f653 100644 (file)
@@ -735,10 +735,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;