]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: new AioTrim operation to force copyup on object removal
authorJason Dillaman <dillaman@redhat.com>
Wed, 20 May 2015 17:55:18 +0000 (13:55 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 5 Jun 2015 15:46:30 +0000 (11:46 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AioRequest.h

index 60b2b02d5ec4badaeadc4928170d28664c6ed67a..24c89ce8beb2ec9eb29efc0ff405b085cf3fe30a 100644 (file)
@@ -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,