]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: EC Optimizations: Add shard_id_sets for backfill_target and ...
authorBill Scales <bill_scales@uk.ibm.com>
Wed, 26 Mar 2025 10:05:07 +0000 (10:05 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 22 Apr 2025 07:04:24 +0000 (08:04 +0100)
acting_recovery_backfill

Optimized EC code uses shard_id_sets as a convinient and fast way of
representing sets of shards. Peering calculates a backfill_target set
and an active_recovery_backfill set as a map of pg_shard_ids during
peering and these are then used while processing I/O requests.

Modify peering so that it initializes a shard_id_set version of
these two sets and makes these available to ECBackend code.

Signed-off-by: Bill Scales <bill_scales@uk.ibm.com>
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index 907c50a6692821886e1502118baca984fa263f04..7ab0ece26f80a14afdb23bc0187074cbcf6c116e 100644 (file)
@@ -356,6 +356,9 @@ public:
   const std::set<pg_shard_t> &get_acting_recovery_backfill() const {
     return recovery_state.get_acting_recovery_backfill();
   }
+  const shard_id_set &get_acting_recovery_backfill_shard_id_set() const {
+    return recovery_state.get_acting_recovery_backfill_shard_id_set();
+  }
   bool is_acting(pg_shard_t osd) const {
     return recovery_state.is_acting(osd);
   }
index 5889d6d3ba5ea5fed8a9424a3ad22090503b8e77..3d0a74dcf6f8f18a61274c7717f647f83582afa3 100644 (file)
@@ -778,6 +778,7 @@ void PeeringState::start_peering_interval(
 
   peer_purged.clear();
   acting_recovery_backfill.clear();
+  acting_recovery_backfill_shard_id_set.clear();
 
   // reset primary/replica state?
   if (was_old_primary || is_primary()) {
@@ -969,6 +970,7 @@ void PeeringState::clear_recovery_state()
 {
   async_recovery_targets.clear();
   backfill_targets.clear();
+  backfill_target_shard_id_set.clear();
 }
 
 void PeeringState::clear_primary_state()
@@ -2556,6 +2558,12 @@ bool PeeringState::choose_acting(pg_shard_t &auth_log_shard_id,
     return true;
   want_acting.clear();
   acting_recovery_backfill = want_acting_backfill;
+  acting_recovery_backfill_shard_id_set.clear();
+  for (auto &ps : acting_recovery_backfill) {
+    if (ps.shard != shard_id_t::NO_SHARD) {
+      acting_recovery_backfill_shard_id_set.insert(ps.shard);
+    }
+  }
   psdout(10) << "acting_recovery_backfill is "
             << acting_recovery_backfill << dendl;
   ceph_assert(
@@ -2564,6 +2572,12 @@ bool PeeringState::choose_acting(pg_shard_t &auth_log_shard_id,
   if (backfill_targets.empty()) {
     // Caller is GetInfo
     backfill_targets = want_backfill;
+    backfill_target_shard_id_set.clear();
+    for (auto &&i : want_backfill) {
+      if (i.shard != shard_id_t::NO_SHARD) {
+        backfill_target_shard_id_set.insert(i.shard);
+      }
+    }
   }
   // Adding !needs_recovery() to let the async_recovery_targets reset after recovery is complete
   ceph_assert(
index 6cc40c4d4eb47b7a3fcc5a9b4a54ccb6150e1489..1a7323b4127c666ec534d564819e32459d0bbe30 100644 (file)
@@ -1443,6 +1443,7 @@ public:
 
   /// union of acting, recovery, and backfill targets
   std::set<pg_shard_t> acting_recovery_backfill;
+  shard_id_set acting_recovery_backfill_shard_id_set;
 
   std::vector<HeartbeatStampsRef> hb_stamps;
 
@@ -1559,6 +1560,7 @@ public:
   std::set<pg_shard_t> peer_activated;
 
   std::set<pg_shard_t> backfill_targets;       ///< osds to be backfilled
+  shard_id_set backfill_target_shard_id_set;
   std::set<pg_shard_t> async_recovery_targets; ///< osds to be async recovered
 
   /// osds which might have objects on them which are unfound on the primary
@@ -2297,6 +2299,10 @@ public:
   const std::set<pg_shard_t> &get_backfill_targets() const {
     return backfill_targets;
   }
+  const shard_id_set &get_backfill_target_shard_id_set() const
+  {
+    return backfill_target_shard_id_set;
+  }
   bool is_async_recovery_target(pg_shard_t peer) const {
     return async_recovery_targets.count(peer);
   }
@@ -2306,6 +2312,9 @@ public:
   const std::set<pg_shard_t> &get_acting_recovery_backfill() const {
     return acting_recovery_backfill;
   }
+  const shard_id_set &get_acting_recovery_backfill_shard_id_set() const {
+    return acting_recovery_backfill_shard_id_set;
+  }
 
   const PGLog &get_pg_log() const {
     return pg_log;