]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "pg_interval_interrupt_condition.h" | |
5 | #include "pg.h" | |
6 | ||
7 | #include "crimson/common/log.h" | |
8 | ||
9 | namespace crimson::osd { | |
10 | ||
11 | IOInterruptCondition::IOInterruptCondition(Ref<PG>& pg) | |
12 | : pg(pg), e(pg->get_osdmap_epoch()) {} | |
13 | ||
14 | IOInterruptCondition::~IOInterruptCondition() { | |
15 | // for the sake of forward declaring PG (which is a detivate of | |
16 | // intrusive_ref_counter<...>) | |
17 | } | |
18 | ||
19 | bool IOInterruptCondition::new_interval_created() { | |
20 | bool ret = e < pg->get_interval_start_epoch(); | |
21 | if (ret) | |
22 | ::crimson::get_logger(ceph_subsys_osd).debug( | |
23 | "{} new interval, should interrupt, e{}", *pg, e); | |
24 | return ret; | |
25 | } | |
26 | ||
27 | bool IOInterruptCondition::is_stopping() { | |
28 | if (pg->stopping) | |
29 | ::crimson::get_logger(ceph_subsys_osd).debug( | |
30 | "{} shutting down, should interrupt", *pg); | |
31 | return pg->stopping; | |
32 | } | |
33 | ||
34 | bool IOInterruptCondition::is_primary() { | |
35 | return pg->is_primary(); | |
36 | } | |
37 | ||
38 | } // namespace crimson::osd |