]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/.../pg_interval_interrupt_condition: clarify member, add comments 58463/head
authorSamuel Just <sjust@redhat.com>
Thu, 4 Jul 2024 04:26:23 +0000 (21:26 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 11 Jul 2024 17:51:59 +0000 (10:51 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/pg_interval_interrupt_condition.cc
src/crimson/osd/pg_interval_interrupt_condition.h

index bc54b0914943263844971a6add63d76bb1ef89cc..7a8cceb7f6285f8c755a527f1bddca9efe4cb01a 100644 (file)
@@ -15,8 +15,8 @@ interrupt_cond<crimson::osd::IOInterruptCondition>;
 
 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
@@ -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;
 }
index 95b3595cdd0b3df20cc93e9413c8c7399c2c45fd..46323bb52ccfaa2e54be4fa5397af3b6859d9b01 100644 (file)
@@ -12,15 +12,41 @@ namespace crimson::osd {
 
 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>
@@ -50,7 +76,7 @@ public:
 
 private:
   Ref<PG> pg;
-  epoch_t e;
+  epoch_t epoch_started;
 };
 
 } // namespace crimson::osd