Skip to content

Commit 5f956e5

Browse files
committed
osd/scrub: remove the 'planned scrub' flag set
Signed-off-by: Ronen Friedman <[email protected]>
1 parent 92b0f85 commit 5f956e5

File tree

6 files changed

+24
-107
lines changed

6 files changed

+24
-107
lines changed

src/osd/PG.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ Scrub::schedule_result_t PG::start_scrubbing(
13181318
get_pgbackend()->auto_repair_supported());
13191319

13201320
return m_scrubber->start_scrub_session(
1321-
candidate.level, osd_restrictions, pg_cond, m_planned_scrub);
1321+
candidate.level, osd_restrictions, pg_cond);
13221322
}
13231323

13241324
double PG::next_deepscrub_interval() const
@@ -1351,8 +1351,7 @@ void PG::on_scrub_schedule_input_change(Scrub::delay_ready_t delay_ready)
13511351
void PG::scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type)
13521352
{
13531353
ceph_assert(m_scrubber);
1354-
std::ignore =
1355-
m_scrubber->scrub_requested(scrub_level, scrub_type, m_planned_scrub);
1354+
std::ignore = m_scrubber->scrub_requested(scrub_level, scrub_type);
13561355
}
13571356

13581357
void PG::clear_ready_to_merge() {
@@ -1907,11 +1906,10 @@ ostream& operator<<(ostream& out, const PG& pg)
19071906
{
19081907
out << pg.recovery_state;
19091908

1910-
// listing all scrub-related flags - both current and "planned next scrub"
1909+
// listing all scrub-related flags
19111910
if (pg.is_scrubbing()) {
19121911
out << *pg.m_scrubber;
19131912
}
1914-
out << pg.m_planned_scrub;
19151913

19161914
if (pg.recovery_ops_active)
19171915
out << " rops=" << pg.recovery_ops_active;

src/osd/PG.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,6 @@ class PG : public DoutPrefixProvider,
179179
/// and be removed only in the PrimaryLogPG destructor.
180180
std::unique_ptr<ScrubPgIF> m_scrubber;
181181

182-
/// flags detailing scheduling/operation characteristics of the next scrub
183-
requested_scrub_t m_planned_scrub;
184-
185-
const requested_scrub_t& get_planned_scrub() const {
186-
return m_planned_scrub;
187-
}
188-
189182
/// scrubbing state for both Primary & replicas
190183
bool is_scrub_active() const { return m_scrubber->is_scrub_active(); }
191184

@@ -1387,11 +1380,6 @@ class PG : public DoutPrefixProvider,
13871380

13881381
OSDService* get_pg_osd(ScrubberPasskey) const { return osd; }
13891382

1390-
requested_scrub_t& get_planned_scrub(ScrubberPasskey)
1391-
{
1392-
return m_planned_scrub;
1393-
}
1394-
13951383
void force_object_missing(ScrubberPasskey,
13961384
const std::set<pg_shard_t>& peer,
13971385
const hobject_t& oid,

src/osd/PrimaryLogPG.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ void PrimaryLogPG::do_command(
10551055
f->close_section();
10561056

10571057
if (is_primary() && is_active() && m_scrubber) {
1058-
m_scrubber->dump_scrubber(f.get(), m_planned_scrub);
1058+
m_scrubber->dump_scrubber(f.get());
10591059
}
10601060

10611061
f->open_object_section("agent_state");
@@ -1185,7 +1185,7 @@ void PrimaryLogPG::do_command(
11851185
if (is_primary()) {
11861186
scrub_level_t deep = (prefix == "deep-scrub") ? scrub_level_t::deep
11871187
: scrub_level_t::shallow;
1188-
m_scrubber->on_operator_forced_scrub(f.get(), deep, m_planned_scrub);
1188+
m_scrubber->on_operator_forced_scrub(f.get(), deep);
11891189
} else {
11901190
ss << "Not primary";
11911191
ret = -EPERM;
@@ -13226,7 +13226,7 @@ void PrimaryLogPG::_clear_recovery_state()
1322613226
#ifdef DEBUG_RECOVERY_OIDS
1322713227
recovering_oids.clear();
1322813228
#endif
13229-
dout(15) << __func__ << " flags: " << m_planned_scrub << dendl;
13229+
dout(15) << __func__ << dendl;
1323013230

1323113231
last_backfill_started = hobject_t();
1323213232
set<hobject_t>::iterator i = backfills_in_flight.begin();

src/osd/scrubber/pg_scrubber.cc

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ ostream& operator<<(ostream& out, const scrub_flags_t& sf)
5959
return out;
6060
}
6161

62-
ostream& operator<<(ostream& out, const requested_scrub_t& sf)
63-
{
64-
if (sf.req_scrub)
65-
out << " planned REQ_SCRUB";
66-
67-
return out;
68-
}
69-
7062
void PgScrubber::on_replica_activate()
7163
{
7264
dout(10) << __func__ << dendl;
@@ -570,20 +562,19 @@ void PgScrubber::update_scrub_job(Scrub::delay_ready_t delay_ready)
570562

571563
scrub_level_t PgScrubber::scrub_requested(
572564
scrub_level_t scrub_level,
573-
scrub_type_t scrub_type,
574-
requested_scrub_t& req_flags)
565+
scrub_type_t scrub_type)
575566
{
576567
const bool repair_requested = (scrub_type == scrub_type_t::do_repair);
577568
const bool deep_requested =
578569
(scrub_level == scrub_level_t::deep) || repair_requested;
579570
scrub_level = deep_requested ? scrub_level_t::deep : scrub_level_t::shallow;
580571
dout(10) << fmt::format(
581572
"{}: {}{} scrub requested. "
582-
"@entry:{},last-stamp:{:s},Registered?{}",
573+
"@entry:last-stamp:{:s},Registered?{}",
583574
__func__,
584575
(scrub_type == scrub_type_t::do_repair ? "repair + "
585576
: "not-repair + "),
586-
(deep_requested ? "deep" : "shallow"), req_flags,
577+
(deep_requested ? "deep" : "shallow"),
587578
m_scrub_job->get_sched_time(), registration_state())
588579
<< dendl;
589580

@@ -597,11 +588,6 @@ scrub_level_t PgScrubber::scrub_requested(
597588
return scrub_level_t::shallow;
598589
}
599590

600-
// modifying the planned-scrub flags - to be removed shortly
601-
// User might intervene, so clear this
602-
req_flags.req_scrub = true;
603-
dout(20) << fmt::format("{}: planned scrub:{}", __func__, req_flags) << dendl;
604-
605591
// update the relevant SchedTarget (either shallow or deep). Set its urgency
606592
// to either operator_requested or must_repair. Push it into the queue
607593
auto& trgt = m_scrub_job->get_target(scrub_level);
@@ -790,10 +776,9 @@ void PgScrubber::on_operator_periodic_cmd(
790776
// when asked to force a high-priority scrub
791777
void PgScrubber::on_operator_forced_scrub(
792778
ceph::Formatter* f,
793-
scrub_level_t scrub_level,
794-
requested_scrub_t& request_flags)
779+
scrub_level_t scrub_level)
795780
{
796-
auto deep_req = scrub_requested(scrub_level, scrub_type_t::not_repair, request_flags);
781+
auto deep_req = scrub_requested(scrub_level, scrub_type_t::not_repair);
797782
asok_response_section(f, false, deep_req);
798783
}
799784

@@ -1878,8 +1863,6 @@ void PgScrubber::scrub_finish()
18781863
ceph_assert(m_pg->is_locked());
18791864
ceph_assert(is_queued_or_active());
18801865

1881-
m_planned_scrub = requested_scrub_t{};
1882-
18831866
// if the repair request comes from auto-repair and large number of errors,
18841867
// we would like to cancel auto-repair
18851868
if (m_is_repair && m_flags.auto_repair &&
@@ -2125,9 +2108,8 @@ void PgScrubber::on_mid_scrub_abort(Scrub::delay_cause_t issue)
21252108

21262109
dout(10) << fmt::format(
21272110
"{}: executing target: {}. Session flags: {} up-to-date job: "
2128-
"{} planned: {}",
2129-
__func__, *m_active_target, m_flags, *m_scrub_job,
2130-
m_planned_scrub)
2111+
"{}",
2112+
__func__, *m_active_target, m_flags, *m_scrub_job)
21312113
<< dendl;
21322114

21332115
// copy the aborted target
@@ -2220,8 +2202,7 @@ void PgScrubber::requeue_penalized(
22202202
Scrub::schedule_result_t PgScrubber::start_scrub_session(
22212203
scrub_level_t s_or_d,
22222204
Scrub::OSDRestrictions osd_restrictions,
2223-
Scrub::ScrubPGPreconds pg_cond,
2224-
const requested_scrub_t& requested_flags)
2205+
Scrub::ScrubPGPreconds pg_cond)
22252206
{
22262207
auto& trgt = m_scrub_job->get_target(s_or_d);
22272208
dout(10) << fmt::format(
@@ -2361,14 +2342,9 @@ Scrub::schedule_result_t PgScrubber::start_scrub_session(
23612342
}
23622343

23632344

2364-
/*
2365-
* note that the flags-set fetched from the PG (m_pg->m_planned_scrub)
2366-
* is cleared once scrubbing starts; Some of the values dumped here are
2367-
* thus transitory.
2368-
*/
2345+
///\todo modify the fields dumped here to match the new scrub-job structure
23692346
void PgScrubber::dump_scrubber(
2370-
ceph::Formatter* f,
2371-
const requested_scrub_t& request_flags) const
2347+
ceph::Formatter* f) const
23722348
{
23732349
f->open_object_section("scrubber");
23742350

@@ -2546,7 +2522,6 @@ PgScrubber::PgScrubber(PG* pg)
25462522
, m_pg_id{pg->pg_id}
25472523
, m_osds{m_pg->osd}
25482524
, m_pg_whoami{pg->pg_whoami}
2549-
, m_planned_scrub{pg->get_planned_scrub(ScrubberPasskey{})}
25502525
, preemption_data{pg}
25512526
{
25522527
m_fsm = std::make_unique<ScrubMachine>(m_pg, this);

src/osd/scrubber/pg_scrubber.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ class PgScrubber : public ScrubPgIF,
209209
Scrub::schedule_result_t start_scrub_session(
210210
scrub_level_t s_or_d,
211211
Scrub::OSDRestrictions osd_restrictions,
212-
Scrub::ScrubPGPreconds pg_cond,
213-
const requested_scrub_t& requested_flags) final;
212+
Scrub::ScrubPGPreconds pg_cond) final;
214213

215214
void initiate_regular_scrub(epoch_t epoch_queued) final;
216215

@@ -281,8 +280,7 @@ class PgScrubber : public ScrubPgIF,
281280

282281
scrub_level_t scrub_requested(
283282
scrub_level_t scrub_level,
284-
scrub_type_t scrub_type,
285-
requested_scrub_t& req_flags) final;
283+
scrub_type_t scrub_type) final;
286284

287285
/**
288286
* let the scrubber know that a recovery operation has completed.
@@ -311,11 +309,9 @@ class PgScrubber : public ScrubPgIF,
311309

312310
void on_operator_forced_scrub(
313311
ceph::Formatter* f,
314-
scrub_level_t scrub_level,
315-
requested_scrub_t& request_flags) final;
312+
scrub_level_t scrub_level) final;
316313

317-
void dump_scrubber(ceph::Formatter* f,
318-
const requested_scrub_t& request_flags) const final;
314+
void dump_scrubber(ceph::Formatter* f) const final;
319315

320316
// used if we are a replica
321317

@@ -747,10 +743,6 @@ class PgScrubber : public ScrubPgIF,
747743

748744
scrub_flags_t m_flags;
749745

750-
/// a reference to the details of the next scrub (as requested and managed by
751-
/// the PG)
752-
requested_scrub_t& m_planned_scrub;
753-
754746
bool m_active{false};
755747

756748
/**

src/osd/scrubber_common.h

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -292,38 +292,6 @@ struct PgScrubBeListener {
292292
} // namespace Scrub
293293

294294

295-
/**
296-
* Flags affecting the scheduling and behaviour of the *next* scrub.
297-
*
298-
* we hold two of these flag collections: one
299-
* for the next scrub, and one frozen at initiation (i.e. in pg::queue_scrub())
300-
*/
301-
struct requested_scrub_t {
302-
/**
303-
* scrub must not be aborted.
304-
* Set for explicitly requested scrubs, and for scrubs originated by the
305-
* pairing process with the 'repair' flag set (in the RequestScrub event).
306-
*
307-
* Will be copied into the 'required' scrub flag upon scrub start.
308-
*/
309-
bool req_scrub{false};
310-
};
311-
312-
std::ostream& operator<<(std::ostream& out, const requested_scrub_t& sf);
313-
314-
template <>
315-
struct fmt::formatter<requested_scrub_t> {
316-
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
317-
318-
template <typename FormatContext>
319-
auto format(const requested_scrub_t& rs, FormatContext& ctx) const
320-
{
321-
return fmt::format_to(ctx.out(),
322-
"(plnd:{})",
323-
rs.req_scrub ? " req_scrub" : "");
324-
}
325-
};
326-
327295
/**
328296
* The interface used by the PG when requesting scrub-related info or services
329297
*/
@@ -434,8 +402,7 @@ struct ScrubPgIF {
434402
virtual Scrub::schedule_result_t start_scrub_session(
435403
scrub_level_t s_or_d,
436404
Scrub::OSDRestrictions osd_restrictions,
437-
Scrub::ScrubPGPreconds pg_cond,
438-
const requested_scrub_t& requested_flags) = 0;
405+
Scrub::ScrubPGPreconds pg_cond) = 0;
439406

440407
virtual void set_op_parameters(Scrub::ScrubPGPreconds pg_cond) = 0;
441408

@@ -465,11 +432,9 @@ struct ScrubPgIF {
465432
/// ... by requesting an "operator initiated" scrub
466433
virtual void on_operator_forced_scrub(
467434
ceph::Formatter* f,
468-
scrub_level_t scrub_level,
469-
requested_scrub_t& request_flags) = 0;
435+
scrub_level_t scrub_level) = 0;
470436

471-
virtual void dump_scrubber(ceph::Formatter* f,
472-
const requested_scrub_t& request_flags) const = 0;
437+
virtual void dump_scrubber(ceph::Formatter* f) const = 0;
473438

474439
/**
475440
* Return true if soid is currently being scrubbed and pending IOs should
@@ -534,8 +499,7 @@ struct ScrubPgIF {
534499

535500
virtual scrub_level_t scrub_requested(
536501
scrub_level_t scrub_level,
537-
scrub_type_t scrub_type,
538-
requested_scrub_t& req_flags) = 0;
502+
scrub_type_t scrub_type) = 0;
539503

540504
/**
541505
* let the scrubber know that a recovery operation has completed.

0 commit comments

Comments
 (0)