}
if (changed.count("osd_scrub_min_interval") ||
- changed.count("osd_scrub_max_interval")) {
- resched_all_scrubs();
- dout(0) << __func__ << ": scrub interval change" << dendl;
+ changed.count("osd_scrub_max_interval") ||
+ changed.count("osd_deep_scrub_interval")) {
+ service.get_scrub_services().on_config_change();
+ dout(0) << fmt::format(
+ "{}: scrub interval change (min:{} deep:{} max:{})",
+ __func__, cct->_conf->osd_scrub_min_interval,
+ cct->_conf->osd_deep_scrub_interval,
+ cct->_conf->osd_scrub_max_interval)
+ << dendl;
}
+
check_config();
if (changed.count("osd_asio_thread_count")) {
service.poolctx.stop();
return locked_pg->pg()->sched_scrub();
}
-
-// ////////////////////////////////////////////////////////////////////////// //
-// scrub initiation - OSD code temporarily moved here from OSD.cc
-
-// temporary dout() support for OSD members:
-static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) {
- return *_dout << "osd." << whoami << " " << epoch << " ";
-}
-#undef dout_prefix
-#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch())
-
-void OSD::resched_all_scrubs()
+void OsdScrub::on_config_change()
{
- dout(10) << __func__ << ": start" << dendl;
- auto all_jobs = service.get_scrub_services().list_registered_jobs();
- for (auto& e : all_jobs) {
-
- auto& job = *e;
- dout(20) << __func__ << ": examine " << job.pgid << dendl;
+ auto to_notify = m_queue.list_registered_jobs();
- PGRef pg = _lookup_lock_pg(job.pgid);
- if (!pg)
+ for (const auto& p : to_notify) {
+ dout(30) << fmt::format("rescheduling pg[{}] scrubs", *p) << dendl;
+ auto locked_pg = m_osd_svc.get_locked_pg(p->pgid);
+ if (!locked_pg)
continue;
- dout(15) << __func__ << ": updating scrub schedule on " << job.pgid << dendl;
- pg->on_scrub_schedule_input_change();
-
- pg->unlock();
+ dout(15) << fmt::format(
+ "updating scrub schedule on {}",
+ (locked_pg->pg())->get_pgid())
+ << dendl;
+ locked_pg->pg()->on_scrub_schedule_input_change();
}
- dout(10) << __func__ << ": done" << dendl;
}
-
-// restoring local dout() settings (to be removed in a followup commit)
-#undef dout_prefix
-#define dout_prefix _prefix_fn(_dout, this, __func__)
-
void ScrubQueue::dump_scrubs(ceph::Formatter* f) const
{
ceph_assert(f != nullptr);
~OsdScrub() = default;
- // temporary friendship - only required in this transitory commit
- friend class OSD;
-
// note: public, as accessed by the dout macros
std::ostream& gen_prefix(std::ostream& out, std::string_view fn) const;
void dump_scrubs(ceph::Formatter* f) const; ///< fwd to the queue
+ /**
+ * on_config_change() (the refactored "OSD::sched_all_scrubs()")
+ *
+ * for each PG registered with the OSD (i.e. - for which we are the primary):
+ * lock that PG, and call its on_scrub_schedule_input_change() method
+ * to handle a possible change in one of the configuration parameters
+ * that affect scrub scheduling.
+ */
+ void on_config_change();
+
// implementing the PGs interface to the scrub scheduling objects
// ---------------------------------------------------------------