@@ -39,31 +39,6 @@ PG::BackgroundProcessLock::lock_with_op(SnapTrimEvent &st_event) noexcept
3939 });
4040}
4141
42- void SnapTrimEvent::SubOpBlocker::dump_detail (Formatter *f) const
43- {
44- f->open_array_section (" dependent_operations" );
45- {
46- for (const auto &kv : subops) {
47- f->dump_unsigned (" op_id" , kv.first ->get_id ());
48- }
49- }
50- f->close_section ();
51- }
52-
53- template <class ... Args>
54- void SnapTrimEvent::SubOpBlocker::emplace_back (Args&&... args)
55- {
56- subops.emplace_back (std::forward<Args>(args)...);
57- };
58-
59- SnapTrimEvent::remove_or_update_iertr::future<>
60- SnapTrimEvent::SubOpBlocker::wait_completion ()
61- {
62- return interruptor::do_for_each (subops, [](auto && kv) {
63- return std::move (kv.second );
64- });
65- }
66-
6742void SnapTrimEvent::print (std::ostream &lhs) const
6843{
6944 lhs << " SnapTrimEvent("
@@ -85,19 +60,11 @@ CommonPGPipeline& SnapTrimEvent::client_pp()
8560 return pg->request_pg_pipeline ;
8661}
8762
88- SnapTrimEvent::snap_trim_ertr::future<seastar::stop_iteration>
63+ SnapTrimEvent::snap_trim_event_ret_t
8964SnapTrimEvent::start ()
9065{
9166 ShardServices &shard_services = pg->get_shard_services ();
92- IRef ref = this ;
93- return interruptor::with_interruption (
94- // SnapTrimEvent is a background operation,
95- // it's lifetime is not guarnteed since the caller
96- // returned future is being ignored. We should capture
97- // a self reference thourhgout the entire execution
98- // progress (not only on finally() continuations).
99- // See: PG::on_active_actmap()
100- [&shard_services, this , ref] {
67+ return interruptor::with_interruption ([&shard_services, this ] {
10168 return enter_stage<interruptor>(
10269 client_pp ().wait_for_active
10370 ).then_interruptible ([this ] {
@@ -154,22 +121,19 @@ SnapTrimEvent::start()
154121 return [&shard_services, this ](const auto &to_trim) {
155122 for (const auto & object : to_trim) {
156123 logger ().debug (" {}: trimming {}" , *this , object);
157- auto [op, fut] = shard_services.start_operation_may_interrupt <
158- interruptor, SnapTrimObjSubEvent>(
159- pg,
160- object,
161- snapid);
162124 subop_blocker.emplace_back (
163- std::move (op),
164- std::move (fut)
165- );
125+ shard_services.start_operation_may_interrupt <
126+ interruptor, SnapTrimObjSubEvent>(
127+ pg,
128+ object,
129+ snapid));
166130 }
167131 return interruptor::now ();
168132 }(to_trim).then_interruptible ([this ] {
169133 return enter_stage<interruptor>(wait_subop);
170134 }).then_interruptible ([this ] {
171135 logger ().debug (" {}: awaiting completion" , *this );
172- return subop_blocker.wait_completion ();
136+ return subop_blocker.interruptible_wait_completion ();
173137 }).finally ([this ] {
174138 pg->background_process_lock .unlock ();
175139 }).si_then ([this ] {
@@ -200,11 +164,12 @@ SnapTrimEvent::start()
200164 });
201165 });
202166 });
203- }, [this , ref]
204- (std::exception_ptr eptr) -> snap_trim_ertr::future<seastar::stop_iteration> {
167+ }, [this ](std::exception_ptr eptr) -> snap_trim_event_ret_t {
205168 logger ().debug (" {}: interrupted {}" , *this , eptr);
206169 return crimson::ct_error::eagain::make ();
207- }, pg).finally ([this , ref=std::move (ref)] {
170+ }, pg).finally ([this ] {
171+ // This SnapTrimEvent op lifetime is maintained within
172+ // PerShardState::start_operation() implementation.
208173 logger ().debug (" {}: exit" , *this );
209174 handle.exit ();
210175 });
@@ -216,7 +181,7 @@ CommonPGPipeline& SnapTrimObjSubEvent::client_pp()
216181 return pg->request_pg_pipeline ;
217182}
218183
219- SnapTrimObjSubEvent::remove_or_update_iertr::future<>
184+ SnapTrimObjSubEvent::snap_trim_obj_subevent_ret_t
220185SnapTrimObjSubEvent::remove_clone (
221186 ObjectContextRef obc,
222187 ObjectContextRef head_obc,
@@ -463,7 +428,7 @@ SnapTrimObjSubEvent::remove_or_update(
463428 });
464429}
465430
466- SnapTrimObjSubEvent::remove_or_update_iertr::future<>
431+ SnapTrimObjSubEvent::snap_trim_obj_subevent_ret_t
467432SnapTrimObjSubEvent::start ()
468433{
469434 return enter_stage<interruptor>(
0 commit comments