Skip to content

Commit 08f4347

Browse files
authored
Merge pull request ceph#55009 from ronen-fr/wip-rf-actpr-requeue
osd/scrub: remove scrub_clear_state() Reviewed-by: Samuel Just <[email protected]>
2 parents fb6cce2 + f9d92f1 commit 08f4347

File tree

5 files changed

+24
-36
lines changed

5 files changed

+24
-36
lines changed

src/osd/PrimaryLogPG.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13027,8 +13027,7 @@ void PrimaryLogPG::on_change(ObjectStore::Transaction &t)
1302713027
finish_degraded_object(p->first);
1302813028
}
1302913029

13030-
// requeues waiting_for_scrub
13031-
m_scrubber->scrub_clear_state();
13030+
ceph_assert(waiting_for_scrub.empty());
1303213031

1303313032
for (auto p = waiting_for_blocked_object.begin();
1303413033
p != waiting_for_blocked_object.end();

src/osd/scrubber/pg_scrubber.cc

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,32 +2212,12 @@ PerfCounters& PgScrubber::get_counters_set() const
22122212
void PgScrubber::cleanup_on_finish()
22132213
{
22142214
dout(10) << __func__ << dendl;
2215-
ceph_assert(m_pg->is_locked());
2216-
2217-
state_clear(PG_STATE_SCRUBBING);
2218-
state_clear(PG_STATE_DEEP_SCRUB);
2219-
2220-
m_local_osd_resource.reset();
2221-
requeue_waiting();
2222-
2223-
reset_internal_state();
2224-
m_flags = scrub_flags_t{};
2215+
clear_pgscrub_state();
22252216

2226-
// type-specific state clear
2227-
_scrub_clear_state();
22282217
// PG state flags changed:
22292218
m_pg->publish_stats_to_osd();
22302219
}
22312220

2232-
// uses process_event(), so must be invoked externally
2233-
void PgScrubber::scrub_clear_state()
2234-
{
2235-
dout(10) << __func__ << dendl;
2236-
2237-
clear_pgscrub_state();
2238-
m_fsm->process_event(FullReset{});
2239-
}
2240-
22412221
/*
22422222
* note: does not access the state-machine
22432223
*/

src/osd/scrubber/pg_scrubber.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ class PgScrubber : public ScrubPgIF,
318318

319319
void on_replica_activate() final;
320320

321-
void scrub_clear_state() final;
322-
323321
bool is_queued_or_active() const final;
324322

325323
/**
@@ -421,11 +419,8 @@ class PgScrubber : public ScrubPgIF,
421419
void on_replica_init() final;
422420
void replica_handling_done() final;
423421

424-
/// the version of 'scrub_clear_state()' that does not try to invoke FSM
425-
/// services (thus can be called from FSM reactions)
426422
void clear_pgscrub_state() final;
427423

428-
429424
std::chrono::milliseconds get_scrub_sleep_time() const final;
430425
void queue_for_scrub_resched(Scrub::scrub_prio_t prio) final;
431426

@@ -622,8 +617,12 @@ class PgScrubber : public ScrubPgIF,
622617
*/
623618
std::unique_ptr<Scrub::LocalResourceWrapper> m_local_osd_resource;
624619

625-
void cleanup_on_finish(); // scrub_clear_state() as called for a Primary when
626-
// Active->NotActive
620+
/**
621+
* clearing the scrubber state & the PG's scrub-related flags
622+
* (calls clear_pgscrub_state()).
623+
* Also - publishes the PG stats.
624+
*/
625+
void cleanup_on_finish();
627626

628627
protected:
629628
PG* const m_pg;

src/osd/scrubber/scrub_machine_lstnr.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,15 @@ struct ScrubMachineListener {
135135

136136
virtual void replica_handling_done() = 0;
137137

138-
/// the version of 'scrub_clear_state()' that does not try to invoke FSM
139-
/// services (thus can be called from FSM reactions)
138+
/**
139+
* clears both internal scrub state, and some PG-visible flags:
140+
* - the two scrubbing PG state flags;
141+
* - primary/replica scrub position (chunk boundaries);
142+
* - primary/replica interaction state;
143+
* - the backend state;
144+
* Also runs pending callbacks, and clears the active flags.
145+
* Does not try to invoke FSM events.
146+
*/
140147
virtual void clear_pgscrub_state() = 0;
141148

142149
/// Get time to sleep before next scrub

src/osd/scrubber_common.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,6 @@ struct ScrubPgIF {
326326
/// we are peered as a replica
327327
virtual void on_replica_activate() = 0;
328328

329-
virtual void scrub_clear_state() = 0;
330-
331329
virtual void handle_query_state(ceph::Formatter* f) = 0;
332330

333331
virtual pg_scrubbing_status_t get_schedule() const = 0;
@@ -382,8 +380,13 @@ struct ScrubPgIF {
382380
const hobject_t& soid) = 0;
383381

384382
/**
385-
* the version of 'scrub_clear_state()' that does not try to invoke FSM
386-
* services (thus can be called from FSM reactions)
383+
* clears both internal scrub state, and some PG-visible flags:
384+
* - the two scrubbing PG state flags;
385+
* - primary/replica scrub position (chunk boundaries);
386+
* - primary/replica interaction state;
387+
* - the backend state
388+
* Also runs pending callbacks, and clears the active flags.
389+
* Does not try to invoke FSM events.
387390
*/
388391
virtual void clear_pgscrub_state() = 0;
389392

0 commit comments

Comments
 (0)