]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/journal/ObjectRecorder.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / journal / ObjectRecorder.h
index 8d250e5f04230367842450caae86ca7c563cdec4..ff00e0a0a1f031da668e03994d6e7e7b7315db68 100644 (file)
@@ -4,6 +4,7 @@
 #ifndef CEPH_JOURNAL_OBJECT_RECORDER_H
 #define CEPH_JOURNAL_OBJECT_RECORDER_H
 
+#include "include/utime.h"
 #include "include/Context.h"
 #include "include/rados/librados.hpp"
 #include "common/Cond.h"
@@ -39,12 +40,13 @@ public:
 
   ObjectRecorder(librados::IoCtx &ioctx, const std::string &oid,
                  uint64_t object_number, std::shared_ptr<Mutex> lock,
-                 ContextWQ *work_queue, SafeTimer &timer, Mutex &timer_lock,
-                 Handler *handler, uint8_t order, uint32_t flush_interval,
-                 uint64_t flush_bytes, double flush_age,
-                 uint64_t max_in_flight_appends);
+                 ContextWQ *work_queue, Handler *handler, uint8_t order,
+                 int32_t max_in_flight_appends);
   ~ObjectRecorder() override;
 
+  void set_append_batch_options(int flush_interval, uint64_t flush_bytes,
+                                double flush_age);
+
   inline uint64_t get_object_number() const {
     return m_object_number;
   }
@@ -52,7 +54,7 @@ public:
     return m_oid;
   }
 
-  bool append_unlock(AppendBuffers &&append_buffers);
+  bool append(AppendBuffers &&append_buffers);
   void flush(Context *on_safe);
   void flush(const FutureImplPtr &future);
 
@@ -70,7 +72,7 @@ public:
 
   inline size_t get_pending_appends() const {
     Mutex::Locker locker(*m_lock);
-    return m_append_buffers.size();
+    return m_pending_buffers.size();
   }
 
 private:
@@ -87,7 +89,6 @@ private:
       object_recorder->put();
     }
     void flush(const FutureImplPtr &future) override {
-      Mutex::Locker locker(*(object_recorder->m_lock));
       object_recorder->flush(future);
     }
   };
@@ -111,31 +112,28 @@ private:
 
   ContextWQ *m_op_work_queue;
 
-  SafeTimer &m_timer;
-  Mutex &m_timer_lock;
-
   Handler *m_handler;
 
   uint8_t m_order;
   uint64_t m_soft_max_size;
 
-  uint32_t m_flush_interval;
-  uint64_t m_flush_bytes;
-  double m_flush_age;
-  uint32_t m_max_in_flight_appends;
+  uint32_t m_flush_interval = 0;
+  uint64_t m_flush_bytes = 0;
+  double m_flush_age = 0;
+  int32_t m_max_in_flight_appends;
 
   FlushHandler m_flush_handler;
 
-  Context *m_append_task = nullptr;
-
   mutable std::shared_ptr<Mutex> m_lock;
-  AppendBuffers m_append_buffers;
+  AppendBuffers m_pending_buffers;
+  uint64_t m_pending_bytes = 0;
+  utime_t m_last_flush_time;
+
   uint64_t m_append_tid;
-  uint32_t m_pending_bytes;
 
   InFlightTids m_in_flight_tids;
   InFlightAppends m_in_flight_appends;
-  uint64_t m_size;
+  uint64_t m_object_bytes = 0;
   bool m_overflowed;
   bool m_object_closed;
 
@@ -143,21 +141,11 @@ private:
 
   bool m_in_flight_flushes;
   Cond m_in_flight_flushes_cond;
+  uint64_t m_in_flight_bytes = 0;
 
-  AppendBuffers m_pending_buffers;
-  uint64_t m_aio_sent_size = 0;
-  bool m_aio_scheduled;
-
-  void handle_append_task();
-  void cancel_append_task();
-  void schedule_append_task();
-
-  bool append(const AppendBuffer &append_buffer, bool *schedule_append);
-  bool flush_appends(bool force);
+  bool send_appends(bool force, FutureImplPtr flush_sentinal);
   void handle_append_flushed(uint64_t tid, int r);
   void append_overflowed();
-  void send_appends(AppendBuffers *append_buffers);
-  void send_appends_aio();
 
   void notify_handler_unlock();
 };