]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/librbd/io/AioCompletion.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / librbd / io / AioCompletion.h
index a3edb1414236ed3bc43da8ccc6f534795d6c76d0..ef0a3c8999bc870012f2f5393d7303211e66e91e 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "common/Cond.h"
 #include "common/Mutex.h"
+#include "common/ceph_time.h"
 #include "include/Context.h"
 #include "include/utime.h"
 #include "include/rbd/librbd.hpp"
@@ -53,14 +54,13 @@ struct AioCompletion {
   int ref;
   bool released;
   ImageCtx *ictx;
-  utime_t start_time;
+  coarse_mono_time start_time;
   aio_type_t aio_type;
 
   ReadResult read_result;
 
   AsyncOperation async_op;
 
-  uint64_t journal_tid;
   xlist<AioCompletion*>::item m_xlist_item;
   bool event_notify;
 
@@ -89,10 +89,16 @@ struct AioCompletion {
   }
 
   template <typename T, void (T::*MF)(int) = &T::complete>
-  static AioCompletion *create_and_start(T *obj, ImageCtx *image_ctx,
-                                         aio_type_t type) {
+  static AioCompletion *create(T *obj, ImageCtx *image_ctx, aio_type_t type) {
     AioCompletion *comp = create<T, MF>(obj);
     comp->init_time(image_ctx, type);
+    return comp;
+  }
+
+  template <typename T, void (T::*MF)(int) = &T::complete>
+  static AioCompletion *create_and_start(T *obj, ImageCtx *image_ctx,
+                                         aio_type_t type) {
+    AioCompletion *comp = create<T, MF>(obj, image_ctx, type);
     comp->start_op();
     return comp;
   }
@@ -102,8 +108,8 @@ struct AioCompletion {
                     complete_arg(NULL), rbd_comp(NULL),
                     pending_count(0), blockers(1),
                     ref(1), released(false), ictx(NULL),
-                    aio_type(AIO_TYPE_NONE),
-                    journal_tid(0), m_xlist_item(this), event_notify(false) {
+                    aio_type(AIO_TYPE_NONE), m_xlist_item(this),
+                    event_notify(false) {
   }
 
   ~AioCompletion() {
@@ -136,27 +142,25 @@ struct AioCompletion {
   void set_request_count(uint32_t num);
   void add_request() {
     lock.Lock();
-    assert(pending_count > 0);
+    ceph_assert(pending_count > 0);
     lock.Unlock();
     get();
   }
   void complete_request(ssize_t r);
 
-  void associate_journal_event(uint64_t tid);
-
   bool is_complete();
 
   ssize_t get_return_value();
 
   void get() {
     lock.Lock();
-    assert(ref > 0);
+    ceph_assert(ref > 0);
     ref++;
     lock.Unlock();
   }
   void release() {
     lock.Lock();
-    assert(!released);
+    ceph_assert(!released);
     released = true;
     put_unlock();
   }
@@ -165,7 +169,7 @@ struct AioCompletion {
     put_unlock();
   }
   void put_unlock() {
-    assert(ref > 0);
+    ceph_assert(ref > 0);
     int n = --ref;
     lock.Unlock();
     if (!n) {
@@ -190,7 +194,7 @@ struct AioCompletion {
   }
   void unblock() {
     Mutex::Locker l(lock);
-    assert(blockers > 0);
+    ceph_assert(blockers > 0);
     --blockers;
     if (pending_count == 0 && blockers == 0) {
       finalize(rval);