From ad7372e355f2b0704d5051629a2610476df63d51 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 1 Sep 2020 11:17:41 -0400 Subject: [PATCH] librbd: image dispatch spec tids are assigned by dispatcher This was a legacy implementation where it was assigned by the ImageRequestWQ and therefore needs to be part of the factory methods. Signed-off-by: Jason Dillaman --- src/librbd/api/Io.cc | 22 ++++++++++------------ src/librbd/io/ImageDispatchSpec.h | 29 +++++++++++++---------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/librbd/api/Io.cc b/src/librbd/api/Io.cc index 7c2d10717294f..139a216ea337b 100644 --- a/src/librbd/api/Io.cc +++ b/src/librbd/api/Io.cc @@ -263,7 +263,7 @@ void Io::aio_write(I &image_ctx, io::AioCompletion *aio_comp, uint64_t off, auto req = io::ImageDispatchSpec::create_write( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}}, - std::move(bl), op_flags, trace, 0); + std::move(bl), op_flags, trace); req->send(); } @@ -294,7 +294,7 @@ void Io::aio_discard(I &image_ctx, io::AioCompletion *aio_comp, uint64_t off, auto req = io::ImageDispatchSpec::create_discard( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len, - discard_granularity_bytes, trace, 0); + discard_granularity_bytes, trace); req->send(); } @@ -326,7 +326,7 @@ void Io::aio_write_same(I &image_ctx, io::AioCompletion *aio_comp, auto req = io::ImageDispatchSpec::create_write_same( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len, - std::move(bl), op_flags, trace, 0); + std::move(bl), op_flags, trace); req->send(); } @@ -399,7 +399,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, aio_comp->aio_type = io::AIO_TYPE_WRITE; auto req = io::ImageDispatchSpec::create_write( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}}, - std::move(bl), op_flags, trace, 0); + std::move(bl), op_flags, trace); req->send(); return; } else if (prepend_length == 0 && append_length == 0) { @@ -409,7 +409,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, auto req = io::ImageDispatchSpec::create_write_same( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len, - std::move(bl), op_flags, trace, 0); + std::move(bl), op_flags, trace); req->send(); return; } @@ -437,8 +437,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, prepend_ctx, &image_ctx, io::AIO_TYPE_WRITE); auto prepend_req = io::ImageDispatchSpec::create_write( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, prepend_aio_comp, - {{prepend_offset, prepend_length}}, std::move(bl), op_flags, trace, - 0); + {{prepend_offset, prepend_length}}, std::move(bl), op_flags, trace); prepend_req->send(); } @@ -451,7 +450,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, append_ctx, &image_ctx, io::AIO_TYPE_WRITE); auto append_req = io::ImageDispatchSpec::create_write( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, append_aio_comp, - {{append_offset, append_length}}, std::move(bl), op_flags, trace, 0); + {{append_offset, append_length}}, std::move(bl), op_flags, trace); append_req->send(); } @@ -463,8 +462,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, write_same_ctx, &image_ctx, io::AIO_TYPE_WRITESAME); auto req = io::ImageDispatchSpec::create_write_same( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, write_same_aio_comp, - write_same_offset, write_same_length, std::move(bl), op_flags, trace, - 0); + write_same_offset, write_same_length, std::move(bl), op_flags, trace); req->send(); return; } @@ -474,7 +472,7 @@ void Io::aio_write_zeroes(I& image_ctx, io::AioCompletion *aio_comp, auto req = io::ImageDispatchSpec::create_discard( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, off, len, - discard_granularity_bytes, trace, 0); + discard_granularity_bytes, trace); req->send(); } @@ -508,7 +506,7 @@ void Io::aio_compare_and_write(I &image_ctx, io::AioCompletion *aio_comp, auto req = io::ImageDispatchSpec::create_compare_and_write( image_ctx, io::IMAGE_DISPATCH_LAYER_API_START, aio_comp, {{off, len}}, - std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, trace, 0); + std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, trace); req->send(); } diff --git a/src/librbd/io/ImageDispatchSpec.h b/src/librbd/io/ImageDispatchSpec.h index 8b17b2591b2d6..da1bd2b6ebf25 100644 --- a/src/librbd/io/ImageDispatchSpec.h +++ b/src/librbd/io/ImageDispatchSpec.h @@ -104,7 +104,7 @@ public: Request request; int op_flags; ZTracer::Trace parent_trace; - uint64_t tid; + uint64_t tid = 0; template static ImageDispatchSpec* create_read( @@ -116,43 +116,40 @@ public: image_dispatch_layer, aio_comp, std::move(image_extents), Read{std::move(read_result)}, - op_flags, parent_trace, 0); + op_flags, parent_trace); } template static ImageDispatchSpec* create_discard( ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer, AioCompletion *aio_comp, uint64_t off, uint64_t len, - uint32_t discard_granularity_bytes, const ZTracer::Trace &parent_trace, - uint64_t tid) { + uint32_t discard_granularity_bytes, const ZTracer::Trace &parent_trace) { return new ImageDispatchSpec(image_ctx.io_image_dispatcher, image_dispatch_layer, aio_comp, {{off, len}}, Discard{discard_granularity_bytes}, - 0, parent_trace, tid); + 0, parent_trace); } template static ImageDispatchSpec* create_write( ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer, AioCompletion *aio_comp, Extents &&image_extents, - bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace, - uint64_t tid) { + bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace) { return new ImageDispatchSpec(image_ctx.io_image_dispatcher, image_dispatch_layer, aio_comp, std::move(image_extents), Write{std::move(bl)}, - op_flags, parent_trace, tid); + op_flags, parent_trace); } template static ImageDispatchSpec* create_write_same( ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer, AioCompletion *aio_comp, uint64_t off, uint64_t len, - bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace, - uint64_t tid) { + bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace) { return new ImageDispatchSpec(image_ctx.io_image_dispatcher, image_dispatch_layer, aio_comp, {{off, len}}, WriteSame{std::move(bl)}, - op_flags, parent_trace, tid); + op_flags, parent_trace); } template @@ -160,14 +157,14 @@ public: ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer, AioCompletion *aio_comp, Extents &&image_extents, bufferlist &&cmp_bl, bufferlist &&bl, uint64_t *mismatch_offset, - int op_flags, const ZTracer::Trace &parent_trace, uint64_t tid) { + int op_flags, const ZTracer::Trace &parent_trace) { return new ImageDispatchSpec(image_ctx.io_image_dispatcher, image_dispatch_layer, aio_comp, std::move(image_extents), CompareAndWrite{std::move(cmp_bl), std::move(bl), mismatch_offset}, - op_flags, parent_trace, tid); + op_flags, parent_trace); } template @@ -177,7 +174,7 @@ public: const ZTracer::Trace &parent_trace) { return new ImageDispatchSpec(image_ctx.io_image_dispatcher, image_dispatch_layer, aio_comp, {}, - Flush{flush_source}, 0, parent_trace, 0); + Flush{flush_source}, 0, parent_trace); } ~ImageDispatchSpec() { @@ -196,11 +193,11 @@ private: ImageDispatchLayer image_dispatch_layer, AioCompletion* aio_comp, Extents&& image_extents, Request&& request, int op_flags, - const ZTracer::Trace& parent_trace, uint64_t tid) + const ZTracer::Trace& parent_trace) : dispatcher_ctx(this), image_dispatcher(image_dispatcher), dispatch_layer(image_dispatch_layer), aio_comp(aio_comp), image_extents(std::move(image_extents)), request(std::move(request)), - op_flags(op_flags), parent_trace(parent_trace), tid(tid) { + op_flags(op_flags), parent_trace(parent_trace) { aio_comp->image_dispatcher_ctx = &dispatcher_ctx; aio_comp->get(); } -- 2.39.5