From da8f89b914d636b910bcc432abf899d738752f73 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 3 Jul 2024 21:26:23 -0700 Subject: [PATCH] crimson/.../pg_interval_interrupt_condition: clarify member, add comments Signed-off-by: Samuel Just (cherry picked from commit b49f82a18b21732dfb18b0714bbfbd94c4b97ba3) --- .../osd/pg_interval_interrupt_condition.cc | 8 ++--- .../osd/pg_interval_interrupt_condition.h | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/crimson/osd/pg_interval_interrupt_condition.cc b/src/crimson/osd/pg_interval_interrupt_condition.cc index bc54b091494..7a8cceb7f62 100644 --- a/src/crimson/osd/pg_interval_interrupt_condition.cc +++ b/src/crimson/osd/pg_interval_interrupt_condition.cc @@ -15,8 +15,8 @@ interrupt_cond; namespace crimson::osd { -IOInterruptCondition::IOInterruptCondition(Ref& pg, epoch_t e) - : pg(pg), e(e) {} +IOInterruptCondition::IOInterruptCondition(Ref& 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 @@ -26,9 +26,9 @@ IOInterruptCondition::~IOInterruptCondition() { 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; } diff --git a/src/crimson/osd/pg_interval_interrupt_condition.h b/src/crimson/osd/pg_interval_interrupt_condition.h index 95b3595cdd0..46323bb52cc 100644 --- a/src/crimson/osd/pg_interval_interrupt_condition.h +++ b/src/crimson/osd/pg_interval_interrupt_condition.h @@ -12,15 +12,41 @@ namespace crimson::osd { class PG; +/** + * IOInterruptCondition + * + * Encapsulates logic for determining whether a continuation chain + * started at 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 + * + * 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, epoch_t e); + IOInterruptCondition(Ref& pg, epoch_t epoch_started); ~IOInterruptCondition(); + /** + * new_interval_created() + * + * Returns true iff the pg has entered a new interval since + * ( < 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 @@ -50,7 +76,7 @@ public: private: Ref pg; - epoch_t e; + epoch_t epoch_started; }; } // namespace crimson::osd -- 2.47.3