]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: remove scrub_clear_state() 55009/head
authorRonen Friedman <rfriedma@redhat.com>
Mon, 25 Dec 2023 18:57:26 +0000 (12:57 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 6 Jan 2024 06:20:12 +0000 (00:20 -0600)
Its functionality is now handled by the FSM when existing
'Session' or 'ActiveReplicaOp' states.
For a PG that is not active - no need to do anything.

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

index d57ab432d4ac0401bea94155add19ed1688eeb5c..4ecbe58a1f3889d890bb031b5fa5d883e78fc66d 100644 (file)
@@ -13027,8 +13027,7 @@ void PrimaryLogPG::on_change(ObjectStore::Transaction &t)
     finish_degraded_object(p->first);
   }
 
-  // requeues waiting_for_scrub
-  m_scrubber->scrub_clear_state();
+  ceph_assert(waiting_for_scrub.empty());
 
   for (auto p = waiting_for_blocked_object.begin();
        p != waiting_for_blocked_object.end();
index f7e027a84f075a71c6c72cac2d855d904c4e50ab..2dae53273a7059a5b4c338ce0a69c0b7791e550b 100644 (file)
@@ -2212,32 +2212,12 @@ PerfCounters& PgScrubber::get_counters_set() const
 void PgScrubber::cleanup_on_finish()
 {
   dout(10) << __func__ << dendl;
-  ceph_assert(m_pg->is_locked());
-
-  state_clear(PG_STATE_SCRUBBING);
-  state_clear(PG_STATE_DEEP_SCRUB);
-
-  m_local_osd_resource.reset();
-  requeue_waiting();
-
-  reset_internal_state();
-  m_flags = scrub_flags_t{};
+  clear_pgscrub_state();
 
-  // type-specific state clear
-  _scrub_clear_state();
   // PG state flags changed:
   m_pg->publish_stats_to_osd();
 }
 
-// uses process_event(), so must be invoked externally
-void PgScrubber::scrub_clear_state()
-{
-  dout(10) << __func__ << dendl;
-
-  clear_pgscrub_state();
-  m_fsm->process_event(FullReset{});
-}
-
 /*
  * note: does not access the state-machine
  */
index adf50f97d92a79aaddcbe431f5a90b9f0eb02fd0..5911b67263f49540521c40ec7cdfc0f292e09f4b 100644 (file)
@@ -318,8 +318,6 @@ class PgScrubber : public ScrubPgIF,
 
   void on_replica_activate() final;
 
-  void scrub_clear_state() final;
-
   bool is_queued_or_active() const final;
 
   /**
@@ -421,11 +419,8 @@ class PgScrubber : public ScrubPgIF,
   void on_replica_init() final;
   void replica_handling_done() final;
 
-  /// the version of 'scrub_clear_state()' that does not try to invoke FSM
-  /// services (thus can be called from FSM reactions)
   void clear_pgscrub_state() final;
 
-
   std::chrono::milliseconds get_scrub_sleep_time() const final;
   void queue_for_scrub_resched(Scrub::scrub_prio_t prio) final;
 
@@ -622,8 +617,12 @@ class PgScrubber : public ScrubPgIF,
    */
   std::unique_ptr<Scrub::LocalResourceWrapper> m_local_osd_resource;
 
-  void cleanup_on_finish();  // scrub_clear_state() as called for a Primary when
-                            // Active->NotActive
+  /**
+   * clearing the scrubber state & the PG's scrub-related flags
+   * (calls clear_pgscrub_state()).
+   * Also - publishes the PG stats.
+   */
+  void cleanup_on_finish();
 
  protected:
   PG* const m_pg;
index f2ddd9c87168a5fffae0ae2fff5f581e5435028a..7849d14e4e4147a0dad3de06e4af4be9e4a70c9c 100644 (file)
@@ -135,8 +135,15 @@ struct ScrubMachineListener {
 
   virtual void replica_handling_done() = 0;
 
-  /// the version of 'scrub_clear_state()' that does not try to invoke FSM
-  /// services (thus can be called from FSM reactions)
+  /**
+   * clears both internal scrub state, and some PG-visible flags:
+   * - the two scrubbing PG state flags;
+   * - primary/replica scrub position (chunk boundaries);
+   * - primary/replica interaction state;
+   * - the backend state;
+   * Also runs pending callbacks, and clears the active flags.
+   * Does not try to invoke FSM events.
+   */
   virtual void clear_pgscrub_state() = 0;
 
   /// Get time to sleep before next scrub
index b41a9b4bba84fdd4b498e85aa3ca68341debcfc8..5323b14677b0b0d97b7b2debafd8312e4d4448d3 100644 (file)
@@ -326,8 +326,6 @@ struct ScrubPgIF {
   /// we are peered as a replica
   virtual void on_replica_activate() = 0;
 
-  virtual void scrub_clear_state() = 0;
-
   virtual void handle_query_state(ceph::Formatter* f) = 0;
 
   virtual pg_scrubbing_status_t get_schedule() const = 0;
@@ -382,8 +380,13 @@ struct ScrubPgIF {
                                        const hobject_t& soid) = 0;
 
   /**
-   * the version of 'scrub_clear_state()' that does not try to invoke FSM
-   * services (thus can be called from FSM reactions)
+   * clears both internal scrub state, and some PG-visible flags:
+   * - the two scrubbing PG state flags;
+   * - primary/replica scrub position (chunk boundaries);
+   * - primary/replica interaction state;
+   * - the backend state
+   * Also runs pending callbacks, and clears the active flags.
+   * Does not try to invoke FSM events.
    */
   virtual void clear_pgscrub_state() = 0;