From: Jason Dillaman Date: Wed, 20 May 2015 17:55:18 +0000 (-0400) Subject: librbd: new AioTrim operation to force copyup on object removal X-Git-Tag: v9.0.2~13^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=64f84182b576c2606501eb3aa1260aa5abcd78f1;p=ceph.git librbd: new AioTrim operation to force copyup on object removal Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h index 60b2b02d5ec4..24c89ce8beb2 100644 --- a/src/librbd/AioRequest.h +++ b/src/librbd/AioRequest.h @@ -271,6 +271,31 @@ namespace librbd { uint8_t m_object_state; }; + class AioTrim : public AbstractWrite { + public: + AioTrim(ImageCtx *ictx, const std::string &oid, uint64_t object_no, + const ::SnapContext &snapc, Context *completion) + : AbstractWrite(ictx, oid, object_no, 0, 0, snapc, completion, true) { + } + + protected: + virtual void add_write_ops(librados::ObjectWriteOperation *wr) { + wr->remove(); + } + + virtual const char* get_write_type() const { + return "remove (trim)"; + } + + virtual void pre_object_map_update(uint8_t *new_state) { + *new_state = OBJECT_PENDING; + } + + virtual bool post_object_map_update() { + return true; + } + }; + class AioTruncate : public AbstractWrite { public: AioTruncate(ImageCtx *ictx, const std::string &oid, uint64_t object_no,