]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: pass image flush requests to object dispatcher
authorJason Dillaman <dillaman@redhat.com>
Tue, 27 Feb 2018 17:25:55 +0000 (12:25 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 7 Mar 2018 17:45:42 +0000 (12:45 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/io/ImageRequest.cc
src/test/librbd/io/test_mock_ImageRequest.cc

index df9a3e6941753d453d4bea57664d72f47a1bd8ee..04557ae4985349120339079ff1b42f8101c416e7 100644 (file)
@@ -597,10 +597,6 @@ void ImageDiscardRequest<I>::update_stats(size_t length) {
 template <typename I>
 void ImageFlushRequest<I>::send_request() {
   I &image_ctx = this->m_image_ctx;
-  if (m_flush_source == FLUSH_SOURCE_USER) {
-    // flag cache for writeback mode if configured
-    image_ctx.user_flushed();
-  }
 
   bool journaling = false;
   {
@@ -636,6 +632,13 @@ void ImageFlushRequest<I>::send_request() {
     }
   }
 
+  // ensure all object dispatch layers have flushed
+  auto object_dispatch_spec = ObjectDispatchSpec::create_flush(
+    &image_ctx, OBJECT_DISPATCH_LAYER_NONE, m_flush_source, this->m_trace, ctx);
+  ctx = new FunctionContext([object_dispatch_spec](int r) {
+      object_dispatch_spec->send(0);
+    });
+
   // ensure all in-flight IOs are settled if non-user flush request
   image_ctx.flush_async_operations(ctx);
   aio_comp->start_op(true);
index 1d22396ce72f1315322999235aac4b96de45504a..7dd0454f2e455955a6d607a68cc7c6d42c9850fc 100644 (file)
@@ -95,10 +95,6 @@ struct TestMockIoImageRequest : public TestMockFixture {
                 }));
   }
 
-  void expect_user_flushed(MockImageCtx &mock_image_ctx) {
-    EXPECT_CALL(mock_image_ctx, user_flushed());
-  }
-
   void expect_flush(MockImageCtx &mock_image_ctx, int r) {
     EXPECT_CALL(mock_image_ctx, flush_cache(_))
       .WillOnce(CompleteContext(r, mock_image_ctx.image_ctx->op_work_queue));
@@ -185,9 +181,9 @@ TEST_F(TestMockIoImageRequest, AioFlushJournalAppendDisabled) {
   mock_image_ctx.journal = &mock_journal;
 
   InSequence seq;
-  expect_user_flushed(mock_image_ctx);
   expect_is_journal_appending(mock_journal, false);
   expect_flush_async_operations(mock_image_ctx, 0);
+  expect_object_request_send(mock_image_ctx, 0);
   expect_flush(mock_image_ctx, 0);
 
   C_SaferCond aio_comp_ctx;