]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: Fix rebase with new io flow 5465/head
authorHaomai Wang <haomai@xsky.com>
Fri, 20 Nov 2015 04:27:27 +0000 (12:27 +0800)
committerHaomai Wang <haomai@xsky.com>
Tue, 1 Dec 2015 02:04:06 +0000 (10:04 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/librbd/AioCompletion.h
src/librbd/AioImageRequestWQ.cc
src/librbd/AioImageRequestWQ.h
src/librbd/librbd.cc
src/tracing/librbd.tp

index 975c916fe6e02439aac69ad9b797732ee894c77c..9b83ab252503eeaf80518f9efa76ad9d1cafa4b0 100644 (file)
@@ -10,6 +10,7 @@
 #include "include/rbd/librbd.hpp"
 
 #include "librbd/AsyncOperation.h"
+#include "librbd/ImageCtx.h"
 
 #include "osdc/Striper.h"
 
@@ -73,7 +74,7 @@ namespace librbd {
                      ref(1), released(false), ictx(NULL),
                      aio_type(AIO_TYPE_NONE),
                      read_bl(NULL), read_buf(NULL), read_buf_len(0),
-                      journal_tid(0) {
+                      journal_tid(0),
                       m_xlist_item(this), event_notify(false) {
     }
     ~AioCompletion() {
index b0e7d3ad03995bdb6e01ec23c610873066e3a05b..7d57849a41f1ca5abd13864db51daf5a895361f7 100644 (file)
@@ -35,7 +35,7 @@ ssize_t AioImageRequestWQ::read(uint64_t off, uint64_t len, char *buf,
 
   C_SaferCond cond;
   AioCompletion *c = aio_create_completion_internal(&cond, rbd_ctx_cb);
-  aio_read(c, off, len, buf, NULL, op_flags);
+  aio_read(c, off, len, buf, NULL, op_flags, false);
   return cond.wait();
 }
 
@@ -54,7 +54,7 @@ ssize_t AioImageRequestWQ::write(uint64_t off, uint64_t len, const char *buf,
 
   C_SaferCond cond;
   AioCompletion *c = aio_create_completion_internal(&cond, rbd_ctx_cb);
-  aio_write(c, off, len, buf, op_flags);
+  aio_write(c, off, len, buf, op_flags, false);
 
   r = cond.wait();
   if (r < 0) {
@@ -77,7 +77,7 @@ int AioImageRequestWQ::discard(uint64_t off, uint64_t len) {
 
   C_SaferCond cond;
   AioCompletion *c = aio_create_completion_internal(&cond, rbd_ctx_cb);
-  aio_discard(c, off, len);
+  aio_discard(c, off, len, false);
 
   r = cond.wait();
   if (r < 0) {
@@ -87,14 +87,14 @@ int AioImageRequestWQ::discard(uint64_t off, uint64_t len) {
 }
 
 void AioImageRequestWQ::aio_read(AioCompletion *c, uint64_t off, uint64_t len,
-                                 char *buf, bufferlist *pbl, int op_flags) {
+                                 char *buf, bufferlist *pbl, int op_flags, bool native_async) {
   c->init_time(&m_image_ctx, librbd::AIO_TYPE_READ);
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 20) << "aio_read: ictx=" << &m_image_ctx << ", "
                  << "completion=" << c << ", off=" << off << ", "
                  << "len=" << len << ", " << "flags=" << op_flags << dendl;
 
-  if (ictx->event_socket.is_valid())
+  if (native_async && m_image_ctx.event_socket.is_valid())
     c->set_event_notify(true);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
@@ -106,14 +106,14 @@ void AioImageRequestWQ::aio_read(AioCompletion *c, uint64_t off, uint64_t len,
 }
 
 void AioImageRequestWQ::aio_write(AioCompletion *c, uint64_t off, uint64_t len,
-                                  const char *buf, int op_flags) {
+                                  const char *buf, int op_flags, bool native_async) {
   c->init_time(&m_image_ctx, librbd::AIO_TYPE_WRITE);
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 20) << "aio_write: ictx=" << &m_image_ctx << ", "
                  << "completion=" << c << ", off=" << off << ", "
                  << "len=" << len << ", flags=" << op_flags << dendl;
 
-  if (ictx->event_socket.is_valid())
+  if (native_async && m_image_ctx.event_socket.is_valid())
     c->set_event_notify(true);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
@@ -126,14 +126,14 @@ void AioImageRequestWQ::aio_write(AioCompletion *c, uint64_t off, uint64_t len,
 }
 
 void AioImageRequestWQ::aio_discard(AioCompletion *c, uint64_t off,
-                                    uint64_t len) {
+                                    uint64_t len, bool native_async) {
   c->init_time(&m_image_ctx, librbd::AIO_TYPE_DISCARD);
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 20) << "aio_discard: ictx=" << &m_image_ctx << ", "
                  << "completion=" << c << ", off=" << off << ", len=" << len
                  << dendl;
 
-  if (ictx->event_socket.is_valid())
+  if (native_async && m_image_ctx.event_socket.is_valid())
     c->set_event_notify(true);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
@@ -145,13 +145,13 @@ void AioImageRequestWQ::aio_discard(AioCompletion *c, uint64_t off,
   }
 }
 
-void AioImageRequestWQ::aio_flush(AioCompletion *c) {
+void AioImageRequestWQ::aio_flush(AioCompletion *c, bool native_async) {
   c->init_time(&m_image_ctx, librbd::AIO_TYPE_FLUSH);
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 20) << "aio_flush: ictx=" << &m_image_ctx << ", "
                  << "completion=" << c << dendl;
 
-  if (ictx->event_socket.is_valid())
+  if (native_async && m_image_ctx.event_socket.is_valid())
     c->set_event_notify(true);
 
   RWLock::RLocker owner_locker(m_image_ctx.owner_lock);
index 9cdb05c6cac6179efd4df5de1f9a40e6b6889543..732a2a8c320d10d25e8f4a0003dff7d550a36828 100644 (file)
@@ -25,11 +25,11 @@ public:
   int discard(uint64_t off, uint64_t len);
 
   void aio_read(AioCompletion *c, uint64_t off, uint64_t len, char *buf,
-                bufferlist *pbl, int op_flags);
+                bufferlist *pbl, int op_flags, bool native_async=true);
   void aio_write(AioCompletion *c, uint64_t off, uint64_t len, const char *buf,
-                 int op_flags);
-  void aio_discard(AioCompletion *c, uint64_t off, uint64_t len);
-  void aio_flush(AioCompletion *c);
+                 int op_flags, bool native_async=true);
+  void aio_discard(AioCompletion *c, uint64_t off, uint64_t len, bool native_async=true);
+  void aio_flush(AioCompletion *c, bool native_async=true);
 
   using ThreadPool::PointerWQ<AioImageRequest>::drain;
   using ThreadPool::PointerWQ<AioImageRequest>::empty;
index 53ed8b80bb668ce5d756d5b0f22830f42b22f46c..35a33c66ecdd3db6fdae4a9972920bd605f88276 100644 (file)
@@ -1000,7 +1000,7 @@ namespace librbd {
   {
     AioCompletion *cs[numcomp];
     ImageCtx *ictx = (ImageCtx *)ctx;
-    tracepoint(librbd, poll_io_events_enter, numcomp);
+    tracepoint(librbd, poll_io_events_enter, ictx, numcomp);
     int r = librbd::poll_io_events(ictx, cs, numcomp);
     tracepoint(librbd, poll_io_events_exit, r);
     if (r > 0) {
@@ -2153,7 +2153,7 @@ extern "C" int rbd_poll_io_events(rbd_image_t image, rbd_completion_t *comps, in
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   librbd::AioCompletion *cs[numcomp];
-  tracepoint(librbd, poll_io_events_enter, numcomp);
+  tracepoint(librbd, poll_io_events_enter, ictx, numcomp);
   int r = librbd::poll_io_events(ictx, cs, numcomp);
   tracepoint(librbd, poll_io_events_exit, r);
   if (r > 0) {
index dbe3d8ff554b6478886a0e11848f8967d88cda1a..146e06ebc8d4d2cc72557e340e5d808f0b890d0b 100644 (file)
@@ -511,7 +511,6 @@ TRACEPOINT_EVENT(librbd, poll_io_events_enter,
     TP_FIELDS(
         ctf_integer_hex(void*, imagectx, imagectx)
         ctf_integer(int, numcomp, numcomp)
-        ctf_integer(int, max, max)
     )
 )