From: Kefu Chai Date: Fri, 21 Aug 2020 05:28:15 +0000 (+0800) Subject: crimson/os/cyanstore: handle OP_ZERO X-Git-Tag: v16.1.0~1347^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5f7963e6bd2245c09af626ea47a4631df2dfa63;p=ceph.git crimson/os/cyanstore: handle OP_ZERO Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc index 3d362dd675a..ec1bc5ce4bf 100644 --- a/src/crimson/os/cyanstore/cyan_store.cc +++ b/src/crimson/os/cyanstore/cyan_store.cc @@ -350,6 +350,15 @@ seastar::future<> CyanStore::do_transaction(CollectionRef ch, r = _write(cid, oid, off, len, bl, fadvise_flags); } break; + case Transaction::OP_ZERO: + { + coll_t cid = i.get_cid(op->cid); + ghobject_t oid = i.get_oid(op->oid); + uint64_t off = op->off; + uint64_t len = op->len; + r = _zero(cid, oid, off, len); + } + break; case Transaction::OP_TRUNCATE: { coll_t cid = i.get_cid(op->cid); @@ -512,6 +521,17 @@ int CyanStore::_write(const coll_t& cid, const ghobject_t& oid, return 0; } +int CyanStore::_zero(const coll_t& cid, const ghobject_t& oid, + uint64_t offset, size_t len) +{ + logger().debug("{} {} {} {} ~ {}", + __func__, cid, oid, offset, len); + + ceph::buffer::list bl; + bl.append_zero(len); + return _write(cid, oid, offset, len, bl, 0); +} + int CyanStore::_omap_clear( 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 71569d8154e..86678042f30 100644 --- a/src/crimson/os/cyanstore/cyan_store.h +++ b/src/crimson/os/cyanstore/cyan_store.h @@ -151,6 +151,8 @@ 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 _zero(const coll_t& cid, const ghobject_t& oid, + uint64_t offset, size_t len); int _omap_clear( const coll_t& cid, const ghobject_t& oid);