Merge pull request #55281 from Matan-B/wip-matanb-crimson-cyanstore-rmcoll

crimson/os/cyanstore: support OP_RMCOLL

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: chunmei-liu <chunmei.liu@intel.com>
This commit is contained in:
Matan Breizman 2024-01-28 11:22:39 +02:00 committed by GitHub
commit 7eb9e33f53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -494,6 +494,12 @@ seastar::future<> CyanStore::Shard::do_transaction_no_callbacks(
r = _create_collection(cid, op->split_bits);
}
break;
case Transaction::OP_RMCOLL:
{
coll_t cid = i.get_cid(op->cid);
r = _remove_collection(cid);
}
break;
case Transaction::OP_SETALLOCHINT:
{
r = 0;
@ -863,6 +869,17 @@ int CyanStore::Shard::_create_collection(const coll_t& cid, int bits)
return 0;
}
int CyanStore::Shard::_remove_collection(const coll_t& cid)
{
logger().debug("{} cid={}", __func__, cid);
auto c = _get_collection(cid);
if (!c) {
return -ENOENT;
}
coll_map.erase(cid);
return 0;
}
boost::intrusive_ptr<Collection>
CyanStore::Shard::_get_collection(const coll_t& cid)
{

View File

@ -148,6 +148,7 @@ class CyanStore final : public FuturizedStore {
std::string_view name);
int _rm_attrs(const coll_t& cid, const ghobject_t& oid);
int _create_collection(const coll_t& cid, int bits);
int _remove_collection(const coll_t& cid);
boost::intrusive_ptr<Collection> _get_collection(const coll_t& cid);
private: