]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: skip truncate request if object does not exist 7772/head
authorxinxin shu <xinxin.shu@intel.com>
Thu, 25 Feb 2016 02:31:52 +0000 (10:31 +0800)
committerxinxin shu <xinxin.shu@intel.com>
Tue, 8 Mar 2016 05:56:35 +0000 (13:56 +0800)
Signed-off-by: xinxin shu <xinxin.shu@intel.com>
src/librbd/AioObjectRequest.cc
src/librbd/AioObjectRequest.h

index 96669eadbe472af456a872bc9585e98b9228a331..cfd1c1e31fc512b0b4d42c74453b177d03169aed 100644 (file)
@@ -575,4 +575,15 @@ namespace librbd {
                           << m_object_off << "~" << m_object_len << dendl;
     send_write_op(true);
   }
+  void AioObjectTruncate::send_write() {
+    ldout(m_ictx->cct, 20) << "send_write " << this << " " << m_oid
+                          << " truncate " << m_object_off << dendl;
+    if (!m_object_exist && ! has_parent()) {
+      m_state = LIBRBD_AIO_WRITE_FLAT;
+      Context *ctx = util::create_context_callback<AioObjectRequest>(this);
+      m_ictx->op_work_queue->queue(ctx, 0);
+    } else {
+      AbstractAioObjectWrite::send_write();
+    }
+  }
 }
index be9ba70cd13d76d6c9d2b25a4fd1f45b39a24be6..2e9226e9a2108229a60fba5b2e43e1bf71aaf021 100644 (file)
@@ -323,6 +323,7 @@ namespace librbd {
       else
        *new_state = OBJECT_EXISTS;
     }
+    virtual void send_write();
   };
 
   class AioObjectZero : public AbstractAioObjectWrite {