From b000324a083b33c9b20bc64c8535087f16e8e455 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 26 Feb 2018 23:49:14 -0500 Subject: [PATCH] librbd: include flush source in image dispatch spec Signed-off-by: Jason Dillaman --- src/librbd/io/ImageDispatchSpec.cc | 2 +- src/librbd/io/ImageDispatchSpec.h | 36 +++++++++++++++++------------- src/librbd/io/ImageRequestWQ.cc | 3 ++- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/librbd/io/ImageDispatchSpec.cc b/src/librbd/io/ImageDispatchSpec.cc index 6064bae665797..d6794c65ee567 100644 --- a/src/librbd/io/ImageDispatchSpec.cc +++ b/src/librbd/io/ImageDispatchSpec.cc @@ -53,7 +53,7 @@ struct ImageDispatchSpec::SendVisitor void operator()(Flush& flush) const { ImageRequest::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); } }; diff --git a/src/librbd/io/ImageDispatchSpec.h b/src/librbd/io/ImageDispatchSpec.h index b8f2319185fd1..cdab827fe8801 100644 --- a/src/librbd/io/ImageDispatchSpec.h +++ b/src/librbd/io/ImageDispatchSpec.h @@ -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(); diff --git a/src/librbd/io/ImageRequestWQ.cc b/src/librbd/io/ImageRequestWQ.cc index ca77c68431426..8886b1a033e22 100644 --- a/src/librbd/io/ImageRequestWQ.cc +++ b/src/librbd/io/ImageRequestWQ.cc @@ -367,7 +367,8 @@ void ImageRequestWQ::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::create_flush_request(m_image_ctx, c, trace)); + queue(ImageDispatchSpec::create_flush_request( + m_image_ctx, c, FLUSH_SOURCE_USER, trace)); } else { ImageRequest::aio_flush(&m_image_ctx, c, FLUSH_SOURCE_USER, trace); finish_in_flight_io(); -- 2.39.5