Skip to content

Commit b49f82a

Browse files
committed
crimson/.../pg_interval_interrupt_condition: clarify member, add comments
Signed-off-by: Samuel Just <[email protected]>
1 parent 252801a commit b49f82a

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

src/crimson/osd/pg_interval_interrupt_condition.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ interrupt_cond<crimson::osd::IOInterruptCondition>;
1515

1616
namespace crimson::osd {
1717

18-
IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg, epoch_t e)
19-
: pg(pg), e(e) {}
18+
IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg, epoch_t epoch_started)
19+
: pg(pg), epoch_started(epoch_started) {}
2020

2121
IOInterruptCondition::~IOInterruptCondition() {
2222
// for the sake of forward declaring PG (which is a detivate of
@@ -26,9 +26,9 @@ IOInterruptCondition::~IOInterruptCondition() {
2626
bool IOInterruptCondition::new_interval_created() {
2727
LOG_PREFIX(IOInterruptCondition::new_interval_created);
2828
const epoch_t interval_start = pg->get_interval_start_epoch();
29-
bool ret = e < interval_start;
29+
bool ret = epoch_started < interval_start;
3030
if (ret) {
31-
DEBUGDPP("stored interval e{} < interval_start e{}", *pg, e, interval_start);
31+
DEBUGDPP("stored epoch_started e{} < interval_start e{}", *pg, epoch_started, interval_start);
3232
}
3333
return ret;
3434
}

src/crimson/osd/pg_interval_interrupt_condition.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,41 @@ namespace crimson::osd {
1212

1313
class PG;
1414

15+
/**
16+
* IOInterruptCondition
17+
*
18+
* Encapsulates logic for determining whether a continuation chain
19+
* started at <epoch_started> should be halted for once of two reasons:
20+
* 1. PG instance is stopping (includes if OSD is shutting down)
21+
* 2. A map advance has caused an interval change since <epoch_started>
22+
*
23+
* <epoch_started> should be the epoch at which the operation was logically
24+
* started, which may or may not pg->get_osdmap_epoch() at the time at which
25+
* with_interruption is actually invoked.
26+
*/
1527
class IOInterruptCondition {
1628
public:
17-
IOInterruptCondition(Ref<PG>& pg, epoch_t e);
29+
IOInterruptCondition(Ref<PG>& pg, epoch_t epoch_started);
1830
~IOInterruptCondition();
1931

32+
/**
33+
* new_interval_created()
34+
*
35+
* Returns true iff the pg has entered a new interval since <epoch_started>
36+
* (<epoch_started> < pg->get_interval_start_epoch())
37+
*/
2038
bool new_interval_created();
2139

40+
/// true iff pg->stopping
2241
bool is_stopping();
2342

43+
/**
44+
* is_primary
45+
*
46+
* True iff the pg is still primary. Used to populate
47+
* ::crimson::common::actingset_changed upon interval change
48+
* to indicate whether client IOs should be requeued.
49+
*/
2450
bool is_primary();
2551

2652
template <typename Fut>
@@ -50,7 +76,7 @@ class IOInterruptCondition {
5076

5177
private:
5278
Ref<PG> pg;
53-
epoch_t e;
79+
epoch_t epoch_started;
5480
};
5581

5682
} // namespace crimson::osd

0 commit comments

Comments
 (0)