summaryrefslogtreecommitdiffstats
path: root/src/crimson/osd/pg_activation_blocker.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/crimson/osd/pg_activation_blocker.cc
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/crimson/osd/pg_activation_blocker.cc')
-rw-r--r--src/crimson/osd/pg_activation_blocker.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/crimson/osd/pg_activation_blocker.cc b/src/crimson/osd/pg_activation_blocker.cc
new file mode 100644
index 000000000..48ffe3f84
--- /dev/null
+++ b/src/crimson/osd/pg_activation_blocker.cc
@@ -0,0 +1,36 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
+// vim: ts=8 sw=2 smarttab expandtab
+
+#include "crimson/osd/pg.h"
+#include "crimson/osd/pg_activation_blocker.h"
+
+namespace crimson::osd {
+
+void PGActivationBlocker::dump_detail(Formatter *f) const
+{
+ f->dump_stream("pgid") << pg->get_pgid();
+}
+
+void PGActivationBlocker::unblock()
+{
+ p.set_value();
+ p = {};
+}
+
+seastar::future<>
+PGActivationBlocker::wait(PGActivationBlocker::BlockingEvent::TriggerI&& trigger)
+{
+ if (pg->get_peering_state().is_active()) {
+ return seastar::now();
+ } else {
+ return trigger.maybe_record_blocking(p.get_shared_future(), *this);
+ }
+}
+
+seastar::future<> PGActivationBlocker::stop()
+{
+ p.set_exception(crimson::common::system_shutdown_exception());
+ return seastar::now();
+}
+
+} // namespace crimson::osd