]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: add support for OP_SPLIT_COLLECTION2
authorXuehan Xu <xuxuehan@qianxin.com>
Wed, 23 Jul 2025 03:15:31 +0000 (11:15 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Thu, 24 Jul 2025 05:27:37 +0000 (13:27 +0800)
Fixes: https://tracker.ceph.com/issues/72173
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/seastore.h

index 9c50fc69f0d7a2e90cec7902943e7fb40a0ca89c..5f4dbb2dc6c3f084899a416bc7ee70eea9385b1f 100644 (file)
@@ -1661,6 +1661,15 @@ SeaStore::Shard::_do_transaction_step(
       i.decode_bl(hint);
       return tm_iertr::now();
     }
+    case Transaction::OP_SPLIT_COLLECTION2:
+    {
+      uint32_t bits = op->split_bits;
+      coll_t cid = i.get_cid(op->cid);
+      coll_t dest_cid = i.get_cid(op->dest_cid);
+      DEBUGT("op OP_SPLIT_COLLECTION2, cid={}, dest_cid={}, bits={}",
+       *ctx.transaction, cid, dest_cid, bits);
+      return _split_collection(ctx, cid, bits);
+    }
   }
 
   using onode_iertr = OnodeManager::get_onode_iertr::extend<
@@ -2239,6 +2248,40 @@ SeaStore::Shard::_rmattrs(
     onode);
 }
 
+SeaStore::Shard::tm_ret
+SeaStore::Shard::_split_collection(
+  internal_context_t &ctx,
+  const coll_t &cid,
+  int bits)
+{
+  return transaction_manager->read_collection_root(
+    *ctx.transaction
+  ).si_then([=, this, &ctx](auto _cmroot) {
+    return seastar::do_with(
+      _cmroot,
+      [=, this, &ctx](auto &cmroot) {
+        return collection_manager->update(
+          cmroot,
+          *ctx.transaction,
+          cid,
+          bits
+        ).si_then([this, &ctx, &cmroot] {
+          if (cmroot.must_update()) {
+            transaction_manager->write_collection_root(
+              *ctx.transaction,
+              cmroot);
+          }
+        });
+      }
+    );
+  }).handle_error_interruptible(
+    tm_iertr::pass_further{},
+    crimson::ct_error::assert_all{
+      "Invalid error in SeaStoreS::_create_collection"
+    }
+  );
+}
+
 SeaStore::Shard::tm_ret
 SeaStore::Shard::_create_collection(
   internal_context_t &ctx,
index 6e6ee83595a462c29fc1f60640e2b46d1ba1b114..0e632279ca560c3000f50e485a92f40d0f44909c 100644 (file)
@@ -437,6 +437,9 @@ public:
     tm_ret _create_collection(
       internal_context_t &ctx,
       const coll_t& cid, int bits);
+    tm_ret _split_collection(
+      internal_context_t &ctx,
+      const coll_t& cid, int bits);
     tm_ret _remove_collection(
       internal_context_t &ctx,
       const coll_t& cid);