]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg: Add helper functions for PG splitting in Crimson
authorAishwarya Mathuria <amathuri@redhat.com>
Mon, 3 Feb 2025 11:54:30 +0000 (11:54 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Thu, 22 May 2025 06:20:37 +0000 (06:20 +0000)
This change adds functions that would perform the tasks of splitting
stats and splitting collections during PG splitting in Crimson

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
src/crimson/osd/pg.h

index 6384f93f72d5b026d756c1b2505df0ef11727d8a..643b9ce58dd38419ff790aefb5a3eef489a52a76 100644 (file)
@@ -598,6 +598,38 @@ public:
   void handle_activate_map(PeeringCtx &rctx);
   void handle_initialize(PeeringCtx &rctx);
 
+  void start_split_stats(const std::set<spg_t>& childpgs, std::vector<object_stat_sum_t> *out) {
+    peering_state.start_split_stats(childpgs, out);
+  }
+
+  void finish_split_stats(const object_stat_sum_t& stats, ObjectStore::Transaction &t) {
+    peering_state.finish_split_stats(stats, t);
+  }
+
+  seastar::future<> split_colls(
+    spg_t child,
+    int split_bits,
+    int seed,
+    const pg_pool_t *pool,
+    ObjectStore::Transaction &t) {
+    coll_t target = coll_t(child);
+    create_pg_collection(t, child, split_bits);
+    coll_t parent_coll = coll_ref->get_cid();
+    t.split_collection(
+      parent_coll,
+      split_bits,
+      seed,
+      target);
+    init_pg_ondisk(t, child, pool);
+    return shard_services.get_store().do_transaction(
+      coll_ref, std::move(t));
+  }
+
+  void split_into(pg_t child_pgid, Ref<PG> child, unsigned split_bits) {
+    peering_state.split_into(child_pgid, &child->peering_state, split_bits);
+    child->snap_trimq = snap_trimq;
+  }
+
   static hobject_t get_oid(const hobject_t& hobj);
   static RWState::State get_lock_type(const OpInfo &op_info);