]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: skip journal event if write/discard was no-op 6979/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 18 Dec 2015 20:14:34 +0000 (15:14 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 18 Dec 2015 20:14:34 +0000 (15:14 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AioImageRequest.cc

index f0c3228119c6b614590285e841e4b967531db3a7..c1d7602ec36ae9320de8289161d1b1cb0f96eeb4 100644 (file)
@@ -248,23 +248,28 @@ void AbstractAioImageWrite::send_request() {
                   !m_image_ctx.journal->is_journal_replaying());
   }
 
+  if (!object_extents.empty()) {
+    m_aio_comp->set_request_count(
+      cct, object_extents.size() + get_cache_request_count(journaling));
+
+    AioObjectRequests requests;
+    send_object_requests(object_extents, snapc,
+                         (journaling ? &requests : nullptr));
+
+    if (journaling) {
+      // in-flight ops are flushed prior to closing the journal
+      assert(m_image_ctx.journal != NULL);
+      journal_tid = append_journal_event(requests, m_synchronous);
+    }
 
-  m_aio_comp->set_request_count(
-    m_image_ctx.cct, object_extents.size() +
-    get_cache_request_count(journaling));
-
-  AioObjectRequests requests;
-  send_object_requests(object_extents, snapc, (journaling ? &requests : NULL));
-
-  if (journaling) {
-    // in-flight ops are flushed prior to closing the journal
-    assert(m_image_ctx.journal != NULL);
-    journal_tid = append_journal_event(requests, m_synchronous);
+    if (m_image_ctx.object_cacher != NULL) {
+      send_cache_requests(object_extents, journal_tid);
+    }
+  } else {
+    // no IO to perform -- fire completion
+    m_aio_comp->unblock(cct);
   }
 
-  if (m_image_ctx.object_cacher != NULL) {
-    send_cache_requests(object_extents, journal_tid);
-  }
   update_stats(clip_len);
   m_aio_comp->put();
 }