return all_jobs;
}
-// ////////////////////////////////////////////////////////////////////////// //
-// ScrubQueue - scrub resource management
-
-bool ScrubQueue::can_inc_scrubs() const
-{
- // consider removing the lock here. Caller already handles delayed
- // inc_scrubs_local() failures
- std::lock_guard lck{resource_lock};
-
- if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
- return true;
- }
-
- dout(20) << " == false. " << scrubs_local << " local + " << scrubs_remote
- << " remote >= max " << conf()->osd_max_scrubs << dendl;
- return false;
-}
-
-bool ScrubQueue::inc_scrubs_local()
-{
- std::lock_guard lck{resource_lock};
-
- if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
- ++scrubs_local;
- return true;
- }
-
- dout(20) << ": " << scrubs_local << " local + " << scrubs_remote
- << " remote >= max " << conf()->osd_max_scrubs << dendl;
- return false;
-}
-
-void ScrubQueue::dec_scrubs_local()
-{
- std::lock_guard lck{resource_lock};
- dout(20) << ": " << scrubs_local << " -> " << (scrubs_local - 1) << " (max "
- << conf()->osd_max_scrubs << ", remote " << scrubs_remote << ")"
- << dendl;
-
- --scrubs_local;
- ceph_assert(scrubs_local >= 0);
-}
-
-bool ScrubQueue::inc_scrubs_remote()
-{
- std::lock_guard lck{resource_lock};
-
- if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
- dout(20) << ": " << scrubs_remote << " -> " << (scrubs_remote + 1)
- << " (max " << conf()->osd_max_scrubs << ", local "
- << scrubs_local << ")" << dendl;
- ++scrubs_remote;
- return true;
- }
-
- dout(20) << ": " << scrubs_local << " local + " << scrubs_remote
- << " remote >= max " << conf()->osd_max_scrubs << dendl;
- return false;
-}
-
-void ScrubQueue::dec_scrubs_remote()
-{
- std::lock_guard lck{resource_lock};
- dout(20) << ": " << scrubs_remote << " -> " << (scrubs_remote - 1) << " (max "
- << conf()->osd_max_scrubs << ", local " << scrubs_local << ")"
- << dendl;
- --scrubs_remote;
- ceph_assert(scrubs_remote >= 0);
-}
-
-void ScrubQueue::dump_scrub_reservations(ceph::Formatter* f) const
-{
- std::lock_guard lck{resource_lock};
- f->dump_int("scrubs_local", scrubs_local);
- f->dump_int("scrubs_remote", scrubs_remote);
- f->dump_int("osd_max_scrubs", conf()->osd_max_scrubs);
-}
void ScrubQueue::clear_pg_scrub_blocked(spg_t blocked_pg)
{
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "./osd_scrub_sched.h"
+
+
+// ////////////////////////////////////////////////////////////////////////// //
+// ScrubQueue - scrub resource management
+
+#define dout_subsys ceph_subsys_osd
+#undef dout_context
+#define dout_context (cct)
+#undef dout_prefix
+#define dout_prefix \
+ *_dout << "osd." << osd_service.get_nodeid() << " scrub-queue::" << __func__ \
+ << " "
+
+bool ScrubQueue::can_inc_scrubs() const
+{
+ // consider removing the lock here. Caller already handles delayed
+ // inc_scrubs_local() failures
+ std::lock_guard lck{resource_lock};
+
+ if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
+ return true;
+ }
+
+ dout(20) << " == false. " << scrubs_local << " local + " << scrubs_remote
+ << " remote >= max " << conf()->osd_max_scrubs << dendl;
+ return false;
+}
+
+bool ScrubQueue::inc_scrubs_local()
+{
+ std::lock_guard lck{resource_lock};
+
+ if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
+ ++scrubs_local;
+ return true;
+ }
+
+ dout(20) << ": " << scrubs_local << " local + " << scrubs_remote
+ << " remote >= max " << conf()->osd_max_scrubs << dendl;
+ return false;
+}
+
+void ScrubQueue::dec_scrubs_local()
+{
+ std::lock_guard lck{resource_lock};
+ dout(20) << ": " << scrubs_local << " -> " << (scrubs_local - 1) << " (max "
+ << conf()->osd_max_scrubs << ", remote " << scrubs_remote << ")"
+ << dendl;
+
+ --scrubs_local;
+ ceph_assert(scrubs_local >= 0);
+}
+
+bool ScrubQueue::inc_scrubs_remote()
+{
+ std::lock_guard lck{resource_lock};
+
+ if (scrubs_local + scrubs_remote < conf()->osd_max_scrubs) {
+ dout(20) << ": " << scrubs_remote << " -> " << (scrubs_remote + 1)
+ << " (max " << conf()->osd_max_scrubs << ", local "
+ << scrubs_local << ")" << dendl;
+ ++scrubs_remote;
+ return true;
+ }
+
+ dout(20) << ": " << scrubs_local << " local + " << scrubs_remote
+ << " remote >= max " << conf()->osd_max_scrubs << dendl;
+ return false;
+}
+
+void ScrubQueue::dec_scrubs_remote()
+{
+ std::lock_guard lck{resource_lock};
+ dout(20) << ": " << scrubs_remote << " -> " << (scrubs_remote - 1) << " (max "
+ << conf()->osd_max_scrubs << ", local " << scrubs_local << ")"
+ << dendl;
+ --scrubs_remote;
+ ceph_assert(scrubs_remote >= 0);
+}
+
+void ScrubQueue::dump_scrub_reservations(ceph::Formatter* f) const
+{
+ std::lock_guard lck{resource_lock};
+ f->dump_int("scrubs_local", scrubs_local);
+ f->dump_int("scrubs_remote", scrubs_remote);
+ f->dump_int("osd_max_scrubs", conf()->osd_max_scrubs);
+}