From df79c3e7ca9d95a838ba60c746868d3de4349515 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 6 Jan 2016 10:02:52 -0500 Subject: [PATCH] librbd: directly execute copy-on-read copyup operations Signed-off-by: Jason Dillaman --- src/librbd/AioObjectRequest.cc | 2 +- src/librbd/CopyupRequest.cc | 12 ------------ src/librbd/CopyupRequest.h | 1 - src/librbd/ImageCtx.cc | 21 +-------------------- src/librbd/ImageCtx.h | 3 --- src/librbd/image/CloseRequest.cc | 23 ----------------------- src/librbd/image/CloseRequest.h | 6 ------ 7 files changed, 2 insertions(+), 66 deletions(-) diff --git a/src/librbd/AioObjectRequest.cc b/src/librbd/AioObjectRequest.cc index e02ebd37f5d19..2ec53e7a176f9 100644 --- a/src/librbd/AioObjectRequest.cc +++ b/src/librbd/AioObjectRequest.cc @@ -262,7 +262,7 @@ namespace librbd { 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(); } } diff --git a/src/librbd/CopyupRequest.cc b/src/librbd/CopyupRequest.cc index 2fd18dd24495f..d7713ad166a09 100644 --- a/src/librbd/CopyupRequest.cc +++ b/src/librbd/CopyupRequest.cc @@ -195,18 +195,6 @@ private: &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)) { diff --git a/src/librbd/CopyupRequest.h b/src/librbd/CopyupRequest.h index cbf7d9fa2964d..4d971d847952f 100644 --- a/src/librbd/CopyupRequest.h +++ b/src/librbd/CopyupRequest.h @@ -23,7 +23,6 @@ namespace librbd { void append_request(AioObjectRequest *req); void send(); - void queue_send(); void complete(int r); diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 6f33962aa413a..154c15a114425 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -161,7 +161,7 @@ struct C_InvalidateCache : public Context { 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)) @@ -206,10 +206,6 @@ struct C_InvalidateCache : public Context { delete object_set; object_set = NULL; } - if (copyup_finisher != NULL) { - delete copyup_finisher; - copyup_finisher = NULL; - } delete[] format_string; md_ctx.aio_flush(); @@ -279,11 +275,6 @@ struct C_InvalidateCache : public Context { 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); } @@ -871,16 +862,6 @@ struct C_InvalidateCache : public Context { 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=" diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 977544a343d38..715fcbb56e188 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -130,7 +130,6 @@ namespace librbd { Readahead readahead; uint64_t total_bytes_read; - Finisher *copyup_finisher; std::map copyup_list; xlist async_ops; @@ -268,8 +267,6 @@ namespace librbd { 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); diff --git a/src/librbd/image/CloseRequest.cc b/src/librbd/image/CloseRequest.cc index 2d7ad38343bbb..57f04a7d8eca5 100644 --- a/src/librbd/image/CloseRequest.cc +++ b/src/librbd/image/CloseRequest.cc @@ -180,29 +180,6 @@ void CloseRequest::handle_shut_down_cache(int r) { if (r < 0) { lderr(cct) << "failed to shut down cache: " << cpp_strerror(r) << dendl; } - send_flush_copyup(); -} - -template -void CloseRequest::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, &CloseRequest::handle_flush_copyup>(this)); -} - -template -void CloseRequest::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(); } diff --git a/src/librbd/image/CloseRequest.h b/src/librbd/image/CloseRequest.h index f22e2dda80b7c..08ace956752ed 100644 --- a/src/librbd/image/CloseRequest.h +++ b/src/librbd/image/CloseRequest.h @@ -49,9 +49,6 @@ private: * SHUTDOWN_CACHE * | * v - * FLUSH_COPYUP (skip if copyup - * | disabled) - * v * FLUSH_OP_WORK_QUEUE . . . . . * | . * v . @@ -90,9 +87,6 @@ private: 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); -- 2.39.5