]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: Skip rbd cache flush if journaling is enabled under aio_flush 9093/head
authorYuan Zhou <yuan.zhou@intel.com>
Thu, 12 May 2016 10:22:12 +0000 (18:22 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Wed, 15 Jun 2016 00:02:03 +0000 (08:02 +0800)
With journaling rbd writes will be persisteted on rbd journal objects.
The journal will be replayed if crash happen. So it's not necessary to
flush rbd_cache in this case. This will improve the flush latency.

This patch adds checking on handling aio_flush: if journaling is
enabled, rbd cache flushing is skipped.
In a system flush(ImageCtx::flush) the cache is flushed even w/ journaling
where we truly do need to flush all IO out to disk.

Fixes: http://tracker.ceph.com/issues/15761
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
src/librbd/AioImageRequest.cc

index 1877af146965ac0e884679799217a29f97a3244a..413e0e62f930199d2f13deb1c36137ba2f979b30 100644 (file)
@@ -454,24 +454,28 @@ void AioImageFlush::send_request() {
                   !m_image_ctx.journal->is_journal_replaying());
   }
 
-  m_aio_comp->set_request_count(journaling ? 2 : 1);
-
   if (journaling) {
     // in-flight ops are flushed prior to closing the journal
     uint64_t journal_tid = m_image_ctx.journal->append_io_event(
       journal::EventEntry(journal::AioFlushEvent()),
       AioObjectRequests(), 0, 0, false);
 
+    m_aio_comp->set_request_count(2);
+
     C_FlushJournalCommit *ctx = new C_FlushJournalCommit(m_image_ctx,
                                                          m_aio_comp,
                                                          journal_tid);
+    C_AioRequest *req_comp = new C_AioRequest(m_aio_comp);
     m_image_ctx.journal->flush_event(journal_tid, ctx);
     m_aio_comp->associate_journal_event(journal_tid);
+    m_image_ctx.flush_async_operations(req_comp);
+  } else {
+    // flush rbd cache only when journaling is not enabled
+    m_aio_comp->set_request_count(1);
+    C_AioRequest *req_comp = new C_AioRequest(m_aio_comp);
+    m_image_ctx.flush(req_comp);
   }
 
-  C_AioRequest *req_comp = new C_AioRequest(m_aio_comp);
-  m_image_ctx.flush(req_comp);
-
   // track flush op for block writes
   m_aio_comp->start_op(true);
   m_aio_comp->put();