From: Kefu Chai Date: Thu, 20 Aug 2020 13:06:24 +0000 (+0800) Subject: crimson/os/cyanstore: handle OP_OMAP_CLEAR X-Git-Tag: v16.1.0~1347^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=df1f1a4b6a89e1c8804dc2789e2f2b2b4af11a8f;p=ceph.git crimson/os/cyanstore: handle OP_OMAP_CLEAR Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc index 57363b1d81ab..3d362dd675a8 100644 --- a/src/crimson/os/cyanstore/cyan_store.cc +++ b/src/crimson/os/cyanstore/cyan_store.cc @@ -376,6 +376,13 @@ seastar::future<> CyanStore::do_transaction(CollectionRef ch, r = _create_collection(cid, op->split_bits); } break; + case Transaction::OP_OMAP_CLEAR: + { + coll_t cid = i.get_cid(op->cid); + ghobject_t oid = i.get_oid(op->oid); + r = _omap_clear(cid, oid); + } + break; case Transaction::OP_OMAP_SETKEYS: { coll_t cid = i.get_cid(op->cid); @@ -505,6 +512,25 @@ int CyanStore::_write(const coll_t& cid, const ghobject_t& oid, return 0; } +int CyanStore::_omap_clear( + const coll_t& cid, + const ghobject_t& oid) +{ + logger().debug("{} {} {}", __func__, cid, oid); + + auto c = _get_collection(cid); + if (!c) { + return -ENOENT; + } + ObjectRef o = c->get_object(oid); + if (!o) { + return -ENOENT; + } + o->omap.clear(); + o->omap_header.clear(); + return 0; +} + int CyanStore::_omap_set_values( const coll_t& cid, const ghobject_t& oid, diff --git a/src/crimson/os/cyanstore/cyan_store.h b/src/crimson/os/cyanstore/cyan_store.h index 877400272b56..71569d8154e1 100644 --- a/src/crimson/os/cyanstore/cyan_store.h +++ b/src/crimson/os/cyanstore/cyan_store.h @@ -151,6 +151,9 @@ private: int _write(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len, const ceph::bufferlist& bl, uint32_t fadvise_flags); + int _omap_clear( + const coll_t& cid, + const ghobject_t& oid); int _omap_set_values( const coll_t& cid, const ghobject_t& oid,