diff options
author | Xuehan Xu <xuxuehan@qianxin.com> | 2024-08-10 08:22:09 +0200 |
---|---|---|
committer | Matan Breizman <mbreizma@redhat.com> | 2024-08-15 10:17:30 +0200 |
commit | db433a62e6b8819d6c9270d38dbb98008aa4f0b1 (patch) | |
tree | 14bc879bfb4479e2601551a95f26385d2a414ed1 /src/crimson/osd/backfill_state.h | |
parent | crimson/osd/pg_recovery: reset backfill_state when backfill finished (diff) | |
download | ceph-db433a62e6b8819d6c9270d38dbb98008aa4f0b1.tar.xz ceph-db433a62e6b8819d6c9270d38dbb98008aa4f0b1.zip |
crimson/osd/backfill_state: support backfilling cancellation
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
Diffstat (limited to 'src/crimson/osd/backfill_state.h')
-rw-r--r-- | src/crimson/osd/backfill_state.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crimson/osd/backfill_state.h b/src/crimson/osd/backfill_state.h index 8c441f01abb..4cdd4daafce 100644 --- a/src/crimson/osd/backfill_state.h +++ b/src/crimson/osd/backfill_state.h @@ -58,6 +58,9 @@ struct BackfillState { struct RequestDone : sc::event<RequestDone> { }; + struct CancelBackfill : sc::event<CancelBackfill> { + }; + private: // internal events struct RequestPrimaryScanning : sc::event<RequestPrimaryScanning> { @@ -132,10 +135,16 @@ public: explicit Crashed(); }; + struct Cancelled : sc::simple_state<Cancelled, BackfillMachine>, + StateHelper<Cancelled> { + explicit Cancelled(); + }; + struct Initial : sc::state<Initial, BackfillMachine>, StateHelper<Initial> { using reactions = boost::mpl::list< sc::custom_reaction<Triggered>, + sc::transition<CancelBackfill, Cancelled>, sc::transition<sc::event_base, Crashed>>; explicit Initial(my_context); // initialize after triggering backfill by on_activate_complete(). @@ -146,6 +155,7 @@ public: struct Enqueuing : sc::state<Enqueuing, BackfillMachine>, StateHelper<Enqueuing> { using reactions = boost::mpl::list< + sc::transition<CancelBackfill, Cancelled>, sc::transition<RequestPrimaryScanning, PrimaryScanning>, sc::transition<RequestReplicasScanning, ReplicasScanning>, sc::transition<RequestWaiting, Waiting>, @@ -206,6 +216,7 @@ public: sc::custom_reaction<ObjectPushed>, sc::custom_reaction<PrimaryScanned>, sc::transition<RequestDone, Done>, + sc::transition<CancelBackfill, Cancelled>, sc::transition<sc::event_base, Crashed>>; explicit PrimaryScanning(my_context); sc::result react(ObjectPushed); @@ -219,6 +230,7 @@ public: sc::custom_reaction<ObjectPushed>, sc::custom_reaction<ReplicaScanned>, sc::transition<RequestDone, Done>, + sc::transition<CancelBackfill, Cancelled>, sc::transition<sc::event_base, Crashed>>; explicit ReplicasScanning(my_context); // collect scanning result; if all results are collected, transition @@ -243,6 +255,7 @@ public: using reactions = boost::mpl::list< sc::custom_reaction<ObjectPushed>, sc::transition<RequestDone, Done>, + sc::transition<CancelBackfill, Cancelled>, sc::transition<sc::event_base, Crashed>>; explicit Waiting(my_context); sc::result react(ObjectPushed); |