lderr(cct) << cpp_strerror(r) << dendl;
ceph_assert(pending_count == 0);
+
+ get();
rval = r;
complete();
put();
template <typename I>
void ImageDispatchSpec<I>::fail(int r) {
- m_aio_comp->get();
m_aio_comp->fail(r);
}
#include "include/int_types.h"
#include "include/buffer.h"
#include "common/zipkin_trace.h"
+#include "librbd/io/AioCompletion.h"
#include "librbd/io/Types.h"
#include "librbd/io/ReadResult.h"
#include <boost/variant/variant.hpp>
namespace io {
-class AioCompletion;
-
template <typename ImageCtxT = ImageCtx>
class ImageDispatchSpec {
public:
0, parent_trace);
}
+ ~ImageDispatchSpec() {
+ m_aio_comp->put();
+ }
+
void send();
void fail(int r);
: 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_aio_comp->get();
}
ImageCtxT& m_image_ctx;
ldout(cct, 20) << get_request_type() << ": ictx=" << &image_ctx << ", "
<< "completion=" << aio_comp << dendl;
- aio_comp->get();
int r = clip_request();
if (r < 0) {
m_aio_comp->fail(r);
}
}
- aio_comp->put();
-
image_ctx.perfcounter->inc(l_librbd_rd);
image_ctx.perfcounter->inc(l_librbd_rd_bytes, buffer_ofs);
}
}
update_stats(clip_len);
- aio_comp->put();
}
template <typename I>
// ensure all in-flight IOs are settled if non-user flush request
aio_comp->async_op.flush(ctx);
- aio_comp->put();
// might be flushing during image shutdown
if (image_ctx.perfcounter != nullptr) {
CephContext *cct = m_image_ctx.cct;
lderr(cct) << "IO received on closed image" << dendl;
- c->get();
c->fail(-ESHUTDOWN);
return false;
}
aio_comp->init_time(ictx, aio_type);
aio_comp->get();
}
+ virtual ~C_AioCompletion() {
+ aio_comp->put();
+ }
void finish(int r) override {
ldout(cct, 20) << "C_AioComplete::finish: r=" << r << dendl;
aio_comp->fail(r);
} else {
aio_comp->complete();
- aio_comp->put();
}
}
};
void expect_fail(MockImageDispatchSpec &mock_image_request, int r) {
EXPECT_CALL(mock_image_request, fail(r))
.WillOnce(Invoke([&mock_image_request](int r) {
- mock_image_request.aio_comp->get();
mock_image_request.aio_comp->fail(r);
}));
}
.WillOnce(Invoke([&mock_image_ctx, &mock_io_image_dispatch_spec, r]() {
auto aio_comp = mock_io_image_dispatch_spec.s_instance->aio_comp;
auto ctx = new FunctionContext([aio_comp](int r) {
- aio_comp->get();
aio_comp->fail(r);
});
mock_image_ctx.image_ctx->op_work_queue->queue(ctx, r);