namespace crimson::osd {
-IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg, epoch_t e)
- : pg(pg), e(e) {}
+IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg, epoch_t epoch_started)
+ : pg(pg), epoch_started(epoch_started) {}
IOInterruptCondition::~IOInterruptCondition() {
// for the sake of forward declaring PG (which is a detivate of
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;
+ bool ret = epoch_started < interval_start;
if (ret) {
- DEBUGDPP("stored interval e{} < interval_start e{}", *pg, e, interval_start);
+ DEBUGDPP("stored epoch_started e{} < interval_start e{}", *pg, epoch_started, interval_start);
}
return ret;
}
class PG;
+/**
+ * IOInterruptCondition
+ *
+ * Encapsulates logic for determining whether a continuation chain
+ * started at <epoch_started> should be halted for once of two reasons:
+ * 1. PG instance is stopping (includes if OSD is shutting down)
+ * 2. A map advance has caused an interval change since <epoch_started>
+ *
+ * <epoch_started> should be the epoch at which the operation was logically
+ * started, which may or may not pg->get_osdmap_epoch() at the time at which
+ * with_interruption is actually invoked.
+ */
class IOInterruptCondition {
public:
- IOInterruptCondition(Ref<PG>& pg, epoch_t e);
+ IOInterruptCondition(Ref<PG>& pg, epoch_t epoch_started);
~IOInterruptCondition();
+ /**
+ * new_interval_created()
+ *
+ * Returns true iff the pg has entered a new interval since <epoch_started>
+ * (<epoch_started> < pg->get_interval_start_epoch())
+ */
bool new_interval_created();
+ /// true iff pg->stopping
bool is_stopping();
+ /**
+ * is_primary
+ *
+ * True iff the pg is still primary. Used to populate
+ * ::crimson::common::actingset_changed upon interval change
+ * to indicate whether client IOs should be requeued.
+ */
bool is_primary();
template <typename Fut>
private:
Ref<PG> pg;
- epoch_t e;
+ epoch_t epoch_started;
};
} // namespace crimson::osd