File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed
Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -486,8 +486,6 @@ class PGBackend
486486 friend class ::crimson::osd::PG;
487487
488488protected:
489- boost::container::flat_set<hobject_t > temp_contents;
490-
491489 template <class ... Args>
492490 void add_temp_obj (Args&&... args) {
493491 temp_contents.insert (std::forward<Args>(args)...);
@@ -501,5 +499,15 @@ class PGBackend
501499 clear_temp_obj (oid);
502500 }
503501 }
502+ template <typename Func>
503+ void for_each_temp_obj (Func &&f) {
504+ std::for_each (temp_contents.begin (), temp_contents.end (), f);
505+ }
506+ void clear_temp_objs () {
507+ temp_contents.clear ();
508+ }
509+ private:
510+ boost::container::flat_set<hobject_t > temp_contents;
511+
504512 friend class RecoveryBackend ;
505513};
Original file line number Diff line number Diff line change @@ -45,11 +45,11 @@ void RecoveryBackend::clear_temp_obj(const hobject_t &oid)
4545void RecoveryBackend::clean_up (ceph::os::Transaction& t,
4646 std::string_view why)
4747{
48- for ( auto & soid : temp_contents ) {
48+ for_each_temp_obj ([&]( auto & soid) {
4949 t.remove (pg.get_collection_ref ()->get_cid (),
5050 ghobject_t (soid, ghobject_t ::NO_GEN, pg.get_pg_whoami ().shard ));
51- }
52- temp_contents. clear ();
51+ });
52+ clear_temp_objs ();
5353
5454 for (auto & [soid, recovery_waiter] : recovering) {
5555 if ((recovery_waiter->pull_info
Original file line number Diff line number Diff line change 1010#include " crimson/os/futurized_collection.h"
1111#include " crimson/osd/pg_interval_interrupt_condition.h"
1212#include " crimson/osd/object_context.h"
13+ #include " crimson/osd/pg_backend.h"
1314#include " crimson/osd/shard_services.h"
1415
1516#include " messages/MOSDPGBackfill.h"
@@ -22,8 +23,6 @@ namespace crimson::osd{
2223 class PG ;
2324}
2425
25- class PGBackend ;
26-
2726class RecoveryBackend {
2827public:
2928 class WaitForObjectRecovery ;
@@ -240,10 +239,15 @@ class RecoveryBackend {
240239 const hobject_t & target,
241240 eversion_t version) const ;
242241
243- boost::container::flat_set<hobject_t > temp_contents;
244-
245242 void add_temp_obj (const hobject_t &oid);
246243 void clear_temp_obj (const hobject_t &oid);
244+ template <typename Func>
245+ void for_each_temp_obj (Func &&f) {
246+ backend->for_each_temp_obj (std::forward<Func>(f));
247+ }
248+ void clear_temp_objs () {
249+ backend->clear_temp_objs ();
250+ }
247251
248252 void clean_up (ceph::os::Transaction& t, std::string_view why);
249253 virtual seastar::future<> on_stop () = 0;
You can’t perform that action at this time.
0 commit comments