From: Xuehan Xu Date: Wed, 23 Jul 2025 03:15:31 +0000 (+0800) Subject: crimson/os/seastore: add support for OP_SPLIT_COLLECTION2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5208cc641e4a5787abebc342f524f300e670a0b0;p=ceph.git crimson/os/seastore: add support for OP_SPLIT_COLLECTION2 Fixes: https://tracker.ceph.com/issues/72173 Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 9c50fc69f0d7..5f4dbb2dc6c3 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -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, diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index 6e6ee83595a4..0e632279ca56 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -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);