summaryrefslogtreecommitdiffstats
path: root/src/crimson/osd/pg_interval_interrupt_condition.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_interval_interrupt_condition.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_interval_interrupt_condition.cc')
-rw-r--r--src/crimson/osd/pg_interval_interrupt_condition.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/crimson/osd/pg_interval_interrupt_condition.cc b/src/crimson/osd/pg_interval_interrupt_condition.cc
new file mode 100644
index 000000000..36243b825
--- /dev/null
+++ b/src/crimson/osd/pg_interval_interrupt_condition.cc
@@ -0,0 +1,43 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "pg_interval_interrupt_condition.h"
+#include "pg.h"
+
+#include "crimson/common/log.h"
+
+SET_SUBSYS(osd);
+
+namespace crimson::osd {
+
+IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg)
+ : pg(pg), e(pg->get_osdmap_epoch()) {}
+
+IOInterruptCondition::~IOInterruptCondition() {
+ // for the sake of forward declaring PG (which is a detivate of
+ // intrusive_ref_counter<...>)
+}
+
+bool IOInterruptCondition::new_interval_created() {
+ LOG_PREFIX(IOInterruptCondition::new_interval_created);
+ const epoch_t interval_start = pg->get_interval_start_epoch();
+ bool ret = e < interval_start;
+ if (ret) {
+ DEBUGDPP("stored interval e{} < interval_start e{}", *pg, e, interval_start);
+ }
+ return ret;
+}
+
+bool IOInterruptCondition::is_stopping() {
+ LOG_PREFIX(IOInterruptCondition::is_stopping);
+ if (pg->stopping) {
+ DEBUGDPP("pg stopping", *pg);
+ }
+ return pg->stopping;
+}
+
+bool IOInterruptCondition::is_primary() {
+ return pg->is_primary();
+}
+
+} // namespace crimson::osd