]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: include flush source in image dispatch spec
authorJason Dillaman <dillaman@redhat.com>
Tue, 27 Feb 2018 04:49:14 +0000 (23:49 -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/ImageDispatchSpec.cc
src/librbd/io/ImageDispatchSpec.h
src/librbd/io/ImageRequestWQ.cc

index 6064bae665797c63b0399154d67097cd4679d85a..d6794c65ee5679c3df401276fa613e120521fee6 100644 (file)
@@ -53,7 +53,7 @@ struct ImageDispatchSpec<I>::SendVisitor
 
   void operator()(Flush& flush) const {
     ImageRequest<I>::aio_flush(
-      &spec->m_image_ctx, spec->m_aio_comp, FLUSH_SOURCE_USER,
+      &spec->m_image_ctx, spec->m_aio_comp, flush.flush_source,
       spec->m_parent_trace);
   }
 };
index b8f2319185fd16639aa81eba20e04a7c4204af21..cdab827fe8801ac5b66a8b71827da446de5cb0cc 100644 (file)
@@ -64,6 +64,10 @@ public:
   };
 
   struct Flush {
+    FlushSource flush_source;
+
+    Flush(FlushSource flush_source) : flush_source(flush_source) {
+    }
   };
 
   static ImageDispatchSpec* create_read_request(
@@ -71,32 +75,32 @@ public:
       ReadResult &&read_result, int op_flags,
       const ZTracer::Trace &parent_trace) {
     return new ImageDispatchSpec(image_ctx, aio_comp,
-                                  std::move(image_extents),
-                                  Read{std::move(read_result)},
-                                  op_flags, parent_trace);
+                                 std::move(image_extents),
+                                 Read{std::move(read_result)},
+                                 op_flags, parent_trace);
   }
 
   static ImageDispatchSpec* create_discard_request(
       ImageCtxT &image_ctx, AioCompletion *aio_comp, uint64_t off, uint64_t len,
       bool skip_partial_discard, const ZTracer::Trace &parent_trace) {
     return new ImageDispatchSpec(image_ctx, aio_comp, {{off, len}},
-                                  Discard{skip_partial_discard}, 0,
-                                  parent_trace);
+                                 Discard{skip_partial_discard}, 0,
+                                 parent_trace);
   }
 
   static ImageDispatchSpec* create_write_request(
       ImageCtxT &image_ctx, AioCompletion *aio_comp, Extents &&image_extents,
       bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace) {
     return new ImageDispatchSpec(image_ctx, aio_comp, std::move(image_extents),
-                                  Write{std::move(bl)}, op_flags, parent_trace);
+                                 Write{std::move(bl)}, op_flags, parent_trace);
   }
 
   static ImageDispatchSpec* create_write_same_request(
       ImageCtxT &image_ctx, AioCompletion *aio_comp, uint64_t off, uint64_t len,
       bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace) {
     return new ImageDispatchSpec(image_ctx, aio_comp, {{off, len}},
-                                  WriteSame{std::move(bl)}, op_flags,
-                                  parent_trace);
+                                 WriteSame{std::move(bl)}, op_flags,
+                                 parent_trace);
   }
 
   static ImageDispatchSpec* create_compare_and_write_request(
@@ -104,18 +108,18 @@ public:
       bufferlist &&cmp_bl, bufferlist &&bl, uint64_t *mismatch_offset,
       int op_flags, const ZTracer::Trace &parent_trace) {
     return new ImageDispatchSpec(image_ctx, aio_comp,
-                                  std::move(image_extents),
-                                  CompareAndWrite{std::move(cmp_bl),
-                                                  std::move(bl),
-                                                  mismatch_offset},
-                                  op_flags, parent_trace);
+                                 std::move(image_extents),
+                                 CompareAndWrite{std::move(cmp_bl),
+                                                 std::move(bl),
+                                                 mismatch_offset},
+                                 op_flags, parent_trace);
   }
 
   static ImageDispatchSpec* create_flush_request(
       ImageCtxT &image_ctx, AioCompletion *aio_comp,
-      const ZTracer::Trace &parent_trace) {
-    return new ImageDispatchSpec(image_ctx, aio_comp, {}, Flush{}, 0,
-                                  parent_trace);
+      FlushSource flush_source, const ZTracer::Trace &parent_trace) {
+    return new ImageDispatchSpec(image_ctx, aio_comp, {}, Flush{flush_source},
+                                 0, parent_trace);
   }
 
   void send();
index ca77c68431426f93a698d77983c2898824a87955..8886b1a033e2296a4774971e10066e10efa62442 100644 (file)
@@ -367,7 +367,8 @@ void ImageRequestWQ<I>::aio_flush(AioCompletion *c, bool native_async) {
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
   if (m_image_ctx.non_blocking_aio || writes_blocked() || !writes_empty()) {
-    queue(ImageDispatchSpec<I>::create_flush_request(m_image_ctx, c, trace));
+    queue(ImageDispatchSpec<I>::create_flush_request(
+            m_image_ctx, c, FLUSH_SOURCE_USER, trace));
   } else {
     ImageRequest<I>::aio_flush(&m_image_ctx, c, FLUSH_SOURCE_USER, trace);
     finish_in_flight_io();