auto aio_comp = io::AioCompletion::create_and_start(&flush_ctx, ictx,
io::AIO_TYPE_FLUSH);
auto req = io::ImageDispatchSpec<I>::create_flush_request(
- *ictx, aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
+ *ictx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START,
+ aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
}
auto aio_comp = io::AioCompletion::create_and_start(ctx, m_image_ctx,
io::AIO_TYPE_FLUSH);
auto req = io::ImageDispatchSpec<I>::create_flush_request(
- *m_image_ctx, aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
+ *m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
+ io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
}
auto aio_comp = io::AioCompletion::create_and_start(
ctx, util::get_image_ctx(&m_image_ctx), io::AIO_TYPE_FLUSH);
auto req = io::ImageDispatchSpec<I>::create_flush_request(
- m_image_ctx, aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
+ m_image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
+ io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
return nullptr;
};
C_Dispatcher dispatcher_ctx;
- ImageDispatchLayer dispatch_layer = IMAGE_DISPATCH_LAYER_NONE;
+ ImageDispatchLayer dispatch_layer;
DispatchResult dispatch_result = DISPATCH_RESULT_INVALID;
static ImageDispatchSpec* create_read_request(
- ImageCtxT &image_ctx, AioCompletion *aio_comp, Extents &&image_extents,
+ ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
+ AioCompletion *aio_comp, Extents &&image_extents,
ReadResult &&read_result, int op_flags,
const ZTracer::Trace &parent_trace) {
- return new ImageDispatchSpec(image_ctx, aio_comp,
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp,
std::move(image_extents),
Read{std::move(read_result)},
op_flags, parent_trace, 0);
}
static ImageDispatchSpec* create_discard_request(
- ImageCtxT &image_ctx, AioCompletion *aio_comp, uint64_t off, uint64_t len,
- uint32_t discard_granularity_bytes, const ZTracer::Trace &parent_trace, uint64_t tid) {
- return new ImageDispatchSpec(image_ctx, aio_comp, {{off, len}},
+ 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) {
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp,
+ {{off, len}},
Discard{discard_granularity_bytes},
0, parent_trace, tid);
}
static ImageDispatchSpec* create_write_request(
- ImageCtxT &image_ctx, AioCompletion *aio_comp, Extents &&image_extents,
- bufferlist &&bl, int op_flags, const ZTracer::Trace &parent_trace, uint64_t tid) {
- return new ImageDispatchSpec(image_ctx, aio_comp, std::move(image_extents),
- Write{std::move(bl)}, op_flags, parent_trace, tid);
+ 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) {
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp,
+ std::move(image_extents), Write{std::move(bl)},
+ op_flags, parent_trace, tid);
}
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, uint64_t tid) {
- return new ImageDispatchSpec(image_ctx, aio_comp, {{off, len}},
- WriteSame{std::move(bl)}, op_flags,
- parent_trace, tid);
+ 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) {
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp,
+ {{off, len}}, WriteSame{std::move(bl)},
+ op_flags, parent_trace, tid);
}
static ImageDispatchSpec* create_compare_and_write_request(
- ImageCtxT &image_ctx, AioCompletion *aio_comp, Extents &&image_extents,
+ 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) {
- return new ImageDispatchSpec(image_ctx, aio_comp,
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp,
std::move(image_extents),
CompareAndWrite{std::move(cmp_bl),
std::move(bl),
}
static ImageDispatchSpec* create_flush_request(
- ImageCtxT &image_ctx, AioCompletion *aio_comp,
- FlushSource flush_source, const ZTracer::Trace &parent_trace) {
- return new ImageDispatchSpec(image_ctx, aio_comp, {}, Flush{flush_source},
- 0, parent_trace, 0);
+ ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
+ AioCompletion *aio_comp, FlushSource flush_source,
+ const ZTracer::Trace &parent_trace) {
+ return new ImageDispatchSpec(image_ctx, image_dispatch_layer, aio_comp, {},
+ Flush{flush_source}, 0, parent_trace, 0);
}
~ImageDispatchSpec() {
struct IsWriteOpVisitor;
struct TokenRequestedVisitor;
- ImageDispatchSpec(ImageCtxT& image_ctx, AioCompletion* aio_comp,
- Extents&& image_extents, Request&& request,
- int op_flags, const ZTracer::Trace& parent_trace, uint64_t tid)
- : dispatcher_ctx(this), m_image_ctx(image_ctx), m_aio_comp(aio_comp),
+ ImageDispatchSpec(ImageCtxT& image_ctx,
+ ImageDispatchLayer image_dispatch_layer,
+ AioCompletion* aio_comp, Extents&& image_extents,
+ Request&& request, int op_flags,
+ const ZTracer::Trace& parent_trace, uint64_t tid)
+ : dispatcher_ctx(this), dispatch_layer(image_dispatch_layer),
+ m_image_ctx(image_ctx), m_aio_comp(aio_comp),
m_image_extents(std::move(image_extents)), m_request(std::move(request)),
m_op_flags(op_flags), m_parent_trace(parent_trace), m_tid(tid) {
m_aio_comp->get();
auto aio_comp = librbd::io::AioCompletion::create_and_start(
on_finish, util::get_image_ctx(&image_ctx), librbd::io::AIO_TYPE_FLUSH);
auto req = librbd::io::ImageDispatchSpec<I>::create_flush_request(
- image_ctx, aio_comp, librbd::io::FLUSH_SOURCE_INTERNAL, {});
+ image_ctx, IMAGE_DISPATCH_LAYER_API_START, aio_comp, FLUSH_SOURCE_INTERNAL,
+ {});
req->send();
delete req;
}
if (m_image_ctx.non_blocking_aio || writes_blocked() || !writes_empty() ||
require_lock_on_read()) {
queue(ImageDispatchSpec<I>::create_read_request(
- m_image_ctx, c, {{off, len}}, std::move(read_result), op_flags,
- trace));
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}},
+ std::move(read_result), op_flags, trace));
} else {
c->start_op();
ImageRequest<I>::aio_read(&m_image_ctx, c, {{off, len}},
}
ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write_request(
- m_image_ctx, c, {{off, len}}, std::move(bl), op_flags, trace, tid);
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}}, std::move(bl),
+ op_flags, trace, tid);
std::shared_lock owner_locker{m_image_ctx.owner_lock};
if (m_image_ctx.non_blocking_aio || writes_blocked()) {
}
ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_discard_request(
- m_image_ctx, c, off, len, discard_granularity_bytes, trace, tid);
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, off, len,
+ discard_granularity_bytes, trace, tid);
std::shared_lock owner_locker{m_image_ctx.owner_lock};
if (m_image_ctx.non_blocking_aio || writes_blocked()) {
auto tid = ++m_last_tid;
ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_flush_request(
- m_image_ctx, c, FLUSH_SOURCE_USER, trace);
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, FLUSH_SOURCE_USER, trace);
{
std::lock_guard locker{m_lock};
}
ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_write_same_request(
- m_image_ctx, c, off, len, std::move(bl), op_flags, trace, tid);
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, off, len, std::move(bl),
+ op_flags, trace, tid);
std::shared_lock owner_locker{m_image_ctx.owner_lock};
if (m_image_ctx.non_blocking_aio || writes_blocked()) {
}
ImageDispatchSpec<I> *req = ImageDispatchSpec<I>::create_compare_and_write_request(
- m_image_ctx, c, {{off, len}}, std::move(cmp_bl), std::move(bl),
- mismatch_off, op_flags, trace, tid);
+ m_image_ctx, IMAGE_DISPATCH_LAYER_API_START, c, {{off, len}},
+ std::move(cmp_bl), std::move(bl), mismatch_off, op_flags, trace, tid);
std::shared_lock owner_locker{m_image_ctx.owner_lock};
if (m_image_ctx.non_blocking_aio || writes_blocked()) {
enum ImageDispatchLayer {
IMAGE_DISPATCH_LAYER_NONE = 0,
+ IMAGE_DISPATCH_LAYER_API_START = IMAGE_DISPATCH_LAYER_NONE,
IMAGE_DISPATCH_LAYER_QUEUE,
IMAGE_DISPATCH_LAYER_QOS,
IMAGE_DISPATCH_LAYER_EXCLUSIVE_LOCK,
IMAGE_DISPATCH_LAYER_REFRESH,
+ IMAGE_DISPATCH_LAYER_INTERNAL_START = IMAGE_DISPATCH_LAYER_REFRESH,
IMAGE_DISPATCH_LAYER_JOURNAL,
IMAGE_DISPATCH_LAYER_WRITEBACK_CACHE,
IMAGE_DISPATCH_LAYER_CORE,
auto aio_comp = io::AioCompletion::create_and_start(
ctx, util::get_image_ctx(&image_ctx), io::AIO_TYPE_FLUSH);
auto req = io::ImageDispatchSpec<I>::create_flush_request(
- image_ctx, aio_comp, io::FLUSH_SOURCE_INTERNAL, {});
+ image_ctx, io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
+ io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
}
AioCompletion *aio_comp = nullptr;
static ImageDispatchSpec* create_flush_request(
- librbd::MockRefreshImageCtx &image_ctx, AioCompletion *aio_comp,
- FlushSource flush_source, const ZTracer::Trace &parent_trace) {
+ librbd::MockRefreshImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
+ AioCompletion *aio_comp, FlushSource flush_source,
+ const ZTracer::Trace &parent_trace) {
ceph_assert(s_instance != nullptr);
s_instance->aio_comp = aio_comp;
return s_instance;
bool blocked = false;
static ImageDispatchSpec* create_write_request(
- librbd::MockTestImageCtx &image_ctx, AioCompletion *aio_comp,
- Extents &&image_extents, bufferlist &&bl, int op_flags,
- const ZTracer::Trace &parent_trace, uint64_t tid) {
+ librbd::MockTestImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
+ AioCompletion *aio_comp, Extents &&image_extents, bufferlist &&bl,
+ int op_flags, const ZTracer::Trace &parent_trace, uint64_t tid) {
ceph_assert(s_instance != nullptr);
s_instance->aio_comp = aio_comp;
return s_instance;
}
static ImageDispatchSpec* create_flush_request(
- librbd::MockTestImageCtx &image_ctx, AioCompletion *aio_comp,
- FlushSource flush_source, const ZTracer::Trace &parent_trace) {
+ librbd::MockTestImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
+ AioCompletion *aio_comp, FlushSource flush_source,
+ const ZTracer::Trace &parent_trace) {
ceph_assert(s_instance != nullptr);
s_instance->aio_comp = aio_comp;
return s_instance;
aio_comp = librbd::io::AioCompletion::create_and_start(
&flush_ctx, ictx, librbd::io::AIO_TYPE_FLUSH);
auto req = librbd::io::ImageDispatchSpec<>::create_flush_request(
- *ictx, aio_comp, librbd::io::FLUSH_SOURCE_INTERNAL, {});
+ *ictx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
+ librbd::io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
ASSERT_EQ(0, flush_ctx.wait());
AioCompletion *aio_comp = nullptr;
static ImageDispatchSpec* create_flush_request(
- MockImageCtx &image_ctx, AioCompletion *aio_comp,
- FlushSource flush_source, const ZTracer::Trace &parent_trace) {
+ MockImageCtx &image_ctx, ImageDispatchLayer dispatch_layer,
+ AioCompletion *aio_comp, FlushSource flush_source,
+ const ZTracer::Trace &parent_trace) {
ceph_assert(s_instance != nullptr);
s_instance->aio_comp = aio_comp;
return s_instance;
auto aio_comp = librbd::io::AioCompletion::create_and_start(
&ctx, image_ctx, librbd::io::AIO_TYPE_FLUSH);
auto req = librbd::io::ImageDispatchSpec<>::create_flush_request(
- *image_ctx, aio_comp, librbd::io::FLUSH_SOURCE_INTERNAL, {});
+ *image_ctx, librbd::io::IMAGE_DISPATCH_LAYER_INTERNAL_START, aio_comp,
+ librbd::io::FLUSH_SOURCE_INTERNAL, {});
req->send();
delete req;
return ctx.wait();