]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: blocking parent IO completion no longer required
authorJason Dillaman <dillaman@redhat.com>
Thu, 25 Aug 2016 14:05:15 +0000 (10:05 -0400)
committerJason Dillaman <dillaman@redhat.com>
Sat, 27 Aug 2016 23:37:37 +0000 (19:37 -0400)
The completion will directly invoke the callback with the
result code.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AioObjectRequest.cc
src/librbd/AioObjectRequest.h

index cf7617640b2c2b29fdd940813acf3d9f09a8dc15..8335c607f7fe884f34c3e22089a11c89e3e50f0e 100644 (file)
@@ -148,9 +148,7 @@ AioObjectRead<I>::AioObjectRead(I *ictx, const std::string &oid,
   : AioObjectRequest<I>(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<I>::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 <typename I>
 void AioObjectRead<I>::read_from_parent(const Extents& parent_extents)
 {
   ImageCtx *image_ctx = this->m_ictx;
-  assert(!m_parent_completion);
-  m_parent_completion = AioCompletion::create_and_start<AioObjectRequest<I> >(
-    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<I> >(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);
 }
 
index 068ce1a846dc8e176e3e92312a4a3ce78a9b1c68..30345533ad0cea04a5ad30536d46fd4876df3609 100644 (file)
@@ -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;
 
   /**