]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: add WriteSameLogOperation
authorYuan Lu <yuan.y.lu@intel.com>
Thu, 23 Apr 2020 06:01:51 +0000 (14:01 +0800)
committerYuan Lu <yuan.y.lu@intel.com>
Wed, 6 May 2020 05:11:50 +0000 (13:11 +0800)
Signed-off-by: Peterson, Scott <scott.d.peterson@intel.com>
Signed-off-by: Li, Xiaoyan <xiaoyan.li@intel.com>
Signed-off-by: Lu, Yuan <yuan.y.lu@intel.com>
Signed-off-by: Chamarthy, Mahati <mahati.chamarthy@intel.com>
src/librbd/cache/rwl/LogOperation.cc
src/librbd/cache/rwl/LogOperation.h

index 52f458ec6756ca4bfe4301733d8934322a5cfbaf..d306c55ebed32555b656786bee457c7931031317 100644 (file)
@@ -211,7 +211,7 @@ void WriteLogOperation::complete(int result) {
   utime_t buf_lat = buf_persist_comp_time - buf_persist_time;
   m_perfcounter->tinc(l_librbd_rwl_log_op_buf_to_bufc_t, buf_lat);
   m_perfcounter->hinc(l_librbd_rwl_log_op_buf_to_bufc_t_hist, buf_lat.to_nsec(),
-                    log_entry->ram_entry.write_bytes);
+                      log_entry->ram_entry.write_bytes);
   m_perfcounter->tinc(l_librbd_rwl_log_op_buf_to_app_t, log_append_time - buf_persist_time);
 }
 
@@ -309,6 +309,30 @@ std::ostream &operator<<(std::ostream &os,
   return op.format(os);
 }
 
+WriteSameLogOperation::WriteSameLogOperation(WriteLogOperationSet &set,
+                                             uint64_t image_offset_bytes,
+                                             uint64_t write_bytes,
+                                             uint32_t data_len,
+                                             CephContext *cct)
+  : WriteLogOperation(set, image_offset_bytes, write_bytes, cct) {
+  log_entry =
+    std::make_shared<WriteSameLogEntry>(set.sync_point->log_entry, image_offset_bytes, write_bytes, data_len);
+  ldout(m_cct, 20) << __func__ << " " << this << dendl;
+}
+
+WriteSameLogOperation::~WriteSameLogOperation() { }
+
+std::ostream &WriteSameLogOperation::format(std::ostream &os) const {
+  os << "(Write Same) ";
+  WriteLogOperation::format(os);
+  return os;
+};
+
+std::ostream &operator<<(std::ostream &os,
+                         const WriteSameLogOperation &op) {
+  return op.format(os);
+}
+
 } // namespace rwl
 } // namespace cache
 } // namespace librbd
index c3d42566cdc42db659ac8d18040d6d439b9105c8..ad12f6aac460f2238e3d6ba9db2ff8195276504a 100644 (file)
@@ -202,6 +202,28 @@ public:
                                   const DiscardLogOperation &op);
 };
 
+class WriteSameLogOperation : public WriteLogOperation {
+public:
+  using GenericWriteLogOperation::m_lock;
+  using GenericWriteLogOperation::sync_point;
+  using GenericWriteLogOperation::on_write_append;
+  using GenericWriteLogOperation::on_write_persist;
+  using WriteLogOperation::log_entry;
+  using WriteLogOperation::bl;
+  using WriteLogOperation::buffer_alloc;
+  WriteSameLogOperation(WriteLogOperationSet &set,
+                        const uint64_t image_offset_bytes,
+                        const uint64_t write_bytes,
+                        const uint32_t data_len,
+                        CephContext *cct);
+  ~WriteSameLogOperation();
+  WriteSameLogOperation(const WriteSameLogOperation&) = delete;
+  WriteSameLogOperation &operator=(const WriteSameLogOperation&) = delete;
+  std::ostream &format(std::ostream &os) const;
+  friend std::ostream &operator<<(std::ostream &os,
+                                  const WriteSameLogOperation &op);
+};
+
 } // namespace rwl
 } // namespace cache
 } // namespace librbd