CopyupRequest *new_req = new CopyupRequest(m_ictx, m_oid, m_object_no,
m_parent_extents);
m_ictx->copyup_list[m_object_no] = new_req;
- new_req->queue_send();
+ new_req->send();
}
}
&m_copyup_data, 0);
}
- void CopyupRequest::queue_send()
- {
- // TODO: once the ObjectCacher allows reentrant read requests, the finisher
- // should be eliminated
- ldout(m_ictx->cct, 20) << __func__ << " " << this
- << ": oid " << m_oid << " "
- << ", extents " << m_image_extents << dendl;
- FunctionContext *ctx = new FunctionContext(
- boost::bind(&CopyupRequest::send, this));
- m_ictx->copyup_finisher->queue(ctx);
- }
-
void CopyupRequest::complete(int r)
{
if (should_complete(r)) {
void append_request(AioObjectRequest *req);
void send();
- void queue_send();
void complete(int r);
stripe_unit(0), stripe_count(0), flags(0),
object_cacher(NULL), writeback_handler(NULL), object_set(NULL),
readahead(),
- total_bytes_read(0), copyup_finisher(NULL),
+ total_bytes_read(0),
state(new ImageState<>(this)), exclusive_lock(nullptr),
object_map(nullptr), aio_work_queue(NULL), op_work_queue(NULL),
asok_hook(new LibrbdAdminSocketHook(this))
delete object_set;
object_set = NULL;
}
- if (copyup_finisher != NULL) {
- delete copyup_finisher;
- copyup_finisher = NULL;
- }
delete[] format_string;
md_ctx.aio_flush();
object_cacher->start();
}
- if (clone_copy_on_read) {
- copyup_finisher = new Finisher(cct);
- copyup_finisher->start();
- }
-
readahead.set_trigger_requests(readahead_trigger_requests);
readahead.set_max_readahead_size(readahead_max_bytes);
}
on_finish->complete(0);
}
- void ImageCtx::flush_copyup(Context *on_finish) {
- on_finish = util::create_async_context_callback(*this, on_finish);
- if (copyup_finisher == nullptr) {
- on_finish->complete(0);
- return;
- }
-
- copyup_finisher->queue(on_finish);
- }
-
void ImageCtx::clear_pending_completions() {
Mutex::Locker l(completed_reqs_lock);
ldout(cct, 10) << "clear pending AioCompletion: count="
Readahead readahead;
uint64_t total_bytes_read;
- Finisher *copyup_finisher;
std::map<uint64_t, CopyupRequest*> copyup_list;
xlist<AsyncOperation*> async_ops;
void cancel_async_requests();
void cancel_async_requests(Context *on_finish);
- void flush_copyup(Context *on_finish);
-
void apply_metadata_confs();
ObjectMap *create_object_map(uint64_t snap_id);
if (r < 0) {
lderr(cct) << "failed to shut down cache: " << cpp_strerror(r) << dendl;
}
- send_flush_copyup();
-}
-
-template <typename I>
-void CloseRequest<I>::send_flush_copyup() {
- if (m_image_ctx->copyup_finisher == nullptr) {
- send_flush_op_work_queue();
- return;
- }
-
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << this << " " << __func__ << dendl;
-
- m_image_ctx->flush_copyup(create_context_callback<
- CloseRequest<I>, &CloseRequest<I>::handle_flush_copyup>(this));
-}
-
-template <typename I>
-void CloseRequest<I>::handle_flush_copyup(int r) {
- CephContext *cct = m_image_ctx->cct;
- ldout(cct, 10) << this << " " << __func__ << ": r=" << r << dendl;
-
- m_image_ctx->copyup_finisher->stop();
send_flush_op_work_queue();
}
* SHUTDOWN_CACHE
* |
* v
- * FLUSH_COPYUP (skip if copyup
- * | disabled)
- * v
* FLUSH_OP_WORK_QUEUE . . . . .
* | .
* v .
void send_shut_down_cache();
void handle_shut_down_cache(int r);
- void send_flush_copyup();
- void handle_flush_copyup(int r);
-
void send_flush_op_work_queue();
void handle_flush_op_work_queue(int r);