mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
librbd: skeleton implementation of image snap list dispatch hooks
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
faf70f3fda
commit
d610f3164e
@ -89,6 +89,16 @@ public:
|
||||
io::DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
io::AioCompletion* aio_comp, io::Extents&& image_extents,
|
||||
io::SnapIds&& snap_ids, int list_snaps_flags,
|
||||
io::SnapshotDelta* snapshot_delta, const ZTracer::Trace &parent_trace,
|
||||
uint64_t tid, std::atomic<uint32_t>* image_dispatch_flags,
|
||||
io::DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::list<Context*> Contexts;
|
||||
typedef std::unordered_set<uint64_t> Tids;
|
||||
|
@ -145,6 +145,27 @@ bool ImageDispatch<I>::flush(
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
bool ImageDispatch<I>::list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) {
|
||||
auto cct = m_image_ctx->cct;
|
||||
ldout(cct, 20) << dendl;
|
||||
|
||||
start_in_flight_io(aio_comp);
|
||||
|
||||
*dispatch_result = DISPATCH_RESULT_COMPLETE;
|
||||
ImageListSnapsRequest<I> req(
|
||||
*m_image_ctx, aio_comp, std::move(image_extents), std::move(snap_ids),
|
||||
list_snaps_flags, snapshot_delta, parent_trace);
|
||||
req.send();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
} // namespace librbd
|
||||
|
||||
|
@ -73,6 +73,14 @@ public:
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
private:
|
||||
ImageCtxT* m_image_ctx;
|
||||
|
||||
|
@ -71,6 +71,14 @@ struct ImageDispatchInterface {
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) = 0;
|
||||
|
||||
virtual bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) = 0;
|
||||
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
|
@ -85,12 +85,25 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct ListSnaps {
|
||||
SnapIds snap_ids;
|
||||
int list_snaps_flags;
|
||||
SnapshotDelta* snapshot_delta;
|
||||
|
||||
ListSnaps(SnapIds&& snap_ids, int list_snaps_flags,
|
||||
SnapshotDelta* snapshot_delta)
|
||||
: snap_ids(std::move(snap_ids)), list_snaps_flags(list_snaps_flags),
|
||||
snapshot_delta(snapshot_delta) {
|
||||
}
|
||||
};
|
||||
|
||||
typedef boost::variant<Read,
|
||||
Discard,
|
||||
Write,
|
||||
WriteSame,
|
||||
CompareAndWrite,
|
||||
Flush> Request;
|
||||
Flush,
|
||||
ListSnaps> Request;
|
||||
|
||||
C_Dispatcher dispatcher_ctx;
|
||||
|
||||
@ -181,6 +194,20 @@ public:
|
||||
Flush{flush_source}, {}, 0, parent_trace);
|
||||
}
|
||||
|
||||
template <typename ImageCtxT = ImageCtx>
|
||||
static ImageDispatchSpec* create_list_snaps(
|
||||
ImageCtxT &image_ctx, ImageDispatchLayer image_dispatch_layer,
|
||||
AioCompletion *aio_comp, Extents &&image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace) {
|
||||
return new ImageDispatchSpec(image_ctx.io_image_dispatcher,
|
||||
image_dispatch_layer, aio_comp,
|
||||
std::move(image_extents),
|
||||
ListSnaps{std::move(snap_ids),
|
||||
list_snaps_flags, snapshot_delta},
|
||||
{}, 0, parent_trace);
|
||||
}
|
||||
|
||||
~ImageDispatchSpec() {
|
||||
aio_comp->put();
|
||||
}
|
||||
|
@ -108,6 +108,18 @@ struct ImageDispatcher<I>::SendVisitor : public boost::static_visitor<bool> {
|
||||
&image_dispatch_spec->aio_comp->image_dispatcher_ctx,
|
||||
&image_dispatch_spec->dispatcher_ctx);
|
||||
}
|
||||
|
||||
bool operator()(ImageDispatchSpec::ListSnaps& list_snaps) const {
|
||||
return image_dispatch->list_snaps(
|
||||
image_dispatch_spec->aio_comp,
|
||||
std::move(image_dispatch_spec->image_extents),
|
||||
std::move(list_snaps.snap_ids), list_snaps.list_snaps_flags,
|
||||
list_snaps.snapshot_delta, image_dispatch_spec->parent_trace,
|
||||
image_dispatch_spec->tid, &image_dispatch_spec->image_dispatch_flags,
|
||||
&image_dispatch_spec->dispatch_result,
|
||||
&image_dispatch_spec->aio_comp->image_dispatcher_ctx,
|
||||
&image_dispatch_spec->dispatcher_ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename I>
|
||||
|
@ -90,6 +90,16 @@ public:
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
ImageCtxT* m_image_ctx;
|
||||
|
||||
|
@ -77,6 +77,16 @@ public:
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
ImageCtxT* m_image_ctx;
|
||||
|
||||
|
@ -73,6 +73,16 @@ public:
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
ImageCtxT* m_image_ctx;
|
||||
|
||||
|
@ -88,6 +88,16 @@ public:
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override;
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
struct C_BlockedWrites;
|
||||
|
||||
|
@ -77,6 +77,16 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool list_snaps(
|
||||
AioCompletion* aio_comp, Extents&& image_extents, SnapIds&& snap_ids,
|
||||
int list_snaps_flags, SnapshotDelta* snapshot_delta,
|
||||
const ZTracer::Trace &parent_trace, uint64_t tid,
|
||||
std::atomic<uint32_t>* image_dispatch_flags,
|
||||
DispatchResult* dispatch_result, Context** on_finish,
|
||||
Context* on_dispatched) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace io
|
||||
|
Loading…
Reference in New Issue
Block a user