From: Jason Dillaman Date: Thu, 25 Aug 2016 14:05:15 +0000 (-0400) Subject: librbd: blocking parent IO completion no longer required X-Git-Tag: v11.0.1~363^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=93955250580787df460c81e56452ec3a09855a6e;p=ceph.git librbd: blocking parent IO completion no longer required The completion will directly invoke the callback with the result code. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/AioObjectRequest.cc b/src/librbd/AioObjectRequest.cc index cf7617640b2c..8335c607f7fe 100644 --- a/src/librbd/AioObjectRequest.cc +++ b/src/librbd/AioObjectRequest.cc @@ -148,9 +148,7 @@ AioObjectRead::AioObjectRead(I *ictx, const std::string &oid, : AioObjectRequest(util::get_image_ctx(ictx), oid, objectno, offset, len, snap_id, completion, false), m_buffer_extents(be), m_tried_parent(false), m_sparse(sparse), - m_op_flags(op_flags), m_parent_completion(NULL), - m_state(LIBRBD_AIO_READ_FLAT) { - + m_op_flags(op_flags), m_state(LIBRBD_AIO_READ_FLAT) { guard_read(); } @@ -220,14 +218,6 @@ bool AioObjectRead::should_complete(int r) finished = false; } } - - if (m_tried_parent) { - // release reference to the parent read completion. this request - // might be completed after unblock is invoked. - AioCompletion *parent_completion = m_parent_completion; - parent_completion->unblock(); - parent_completion->put(); - } } break; case LIBRBD_AIO_READ_COPYUP: @@ -328,21 +318,15 @@ template void AioObjectRead::read_from_parent(const Extents& parent_extents) { ImageCtx *image_ctx = this->m_ictx; - assert(!m_parent_completion); - m_parent_completion = AioCompletion::create_and_start >( - this, image_ctx, AIO_TYPE_READ); - - // prevent the parent image from being deleted while this - // request is still in-progress - m_parent_completion->get(); - m_parent_completion->block(); + AioCompletion *parent_completion = AioCompletion::create_and_start< + AioObjectRequest >(this, image_ctx, AIO_TYPE_READ); ldout(image_ctx->cct, 20) << "read_from_parent this = " << this - << " parent completion " << m_parent_completion + << " parent completion " << parent_completion << " extents " << parent_extents << dendl; RWLock::RLocker owner_locker(image_ctx->parent->owner_lock); - AioImageRequest<>::aio_read(image_ctx->parent, m_parent_completion, + AioImageRequest<>::aio_read(image_ctx->parent, parent_completion, parent_extents, NULL, &m_read_data, 0); } diff --git a/src/librbd/AioObjectRequest.h b/src/librbd/AioObjectRequest.h index 068ce1a846dc..30345533ad0c 100644 --- a/src/librbd/AioObjectRequest.h +++ b/src/librbd/AioObjectRequest.h @@ -140,7 +140,6 @@ private: bool m_sparse; int m_op_flags; ceph::bufferlist m_read_data; - AioCompletion *m_parent_completion; ExtentMap m_ext_map; /**