]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore/cbjournal: remove last_committed_record_base
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 5 May 2022 04:31:53 +0000 (13:31 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 19 May 2022 00:31:51 +0000 (09:31 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/journal/circular_bounded_journal.cc
src/crimson/os/seastore/journal/circular_bounded_journal.h
src/test/crimson/seastore/test_cbjournal.cc

index 5047353de07d82c2312dc19d53251bec5b03e6e5..fa1ef3250af52e5ebe9652fa03909486b313462d 100644 (file)
@@ -23,7 +23,6 @@ std::ostream &operator<<(std::ostream &out,
             << ", error=" << header.error
             << ", start_offset=" << header.start_offset
             << ", applied_to="<< header.applied_to
-            << ", last_committed_record_base="<< header.last_committed_record_base
             << ", written_to=" << header.written_to
             << ", flsg=" << header.flag
             << ", csum_type=" << header.csum_type
@@ -286,7 +285,6 @@ CircularBoundedJournal::submit_record_ret CircularBoundedJournal::submit_record(
       "append_record: commit target {} used_size {} written length {}",
       target, get_used_size(), length);
 
-    set_last_committed_record_base(target);
     set_used_size(get_used_size() + length);
     paddr_t paddr = convert_abs_addr_to_paddr(
       target + r_size.get_mdlength(),
@@ -403,7 +401,6 @@ Journal::replay_ret CircularBoundedJournal::replay(
            r_header.committed_to,
            (seastore_off_t)bl.length()
          };
-         set_last_committed_record_base(cursor_addr);
          cursor_addr += bl.length();
          set_written_to(cursor_addr);
          last_seq = r_header.committed_to.segment_seq;
index fa8daef14ab1cf5e4d159fb24c0103c44ef57c5e..f5f04cb1099b680f262253e9312cd1f8b40140ca 100644 (file)
@@ -38,16 +38,15 @@ using NVMeBlockDevice = nvme_device::NVMeBlockDevice;
  * in CBjournal to RBM---the tail (applied_to) is advanced (TODO).
  *
  * - Commit time
- * After submit_record is done, last_committed_record_base and written_to are
- * increased (these are in-memory values)---last_committed_record_base indicates
- * the last committed record and written_to represents where the new record
- * will be appended. Note that applied_to is not changed here.
+ * After submit_record is done, written_to is increased(this in-memory value)
+ * ---written_to represents where the new record will be appended. Note that
+ * applied_to is not changed here.
  *
  * - Replay time
  * At replay time, CBJournal begins to replay records in CBjournal by reading
  * records from applied_to. Then, CBJournal examines whether the records is valid
- * one by one, at which point last_committed_record_base and written_to are
- * recovered if the valid record is founded. Note that only applied_to is stored
+ * one by one, at which point written_to is recovered
+ * if the valid record is founded. Note that only applied_to is stored
  * permanently when the apply work---applying the records in CBJournal to RBM---
  * is done by CBJournal (TODO).
  *
@@ -215,8 +214,6 @@ public:
 
     // start offset of CircularBoundedJournal in the device (start + header length)
     rbm_abs_addr start_offset = 0;
-    // start address where last committed record is written
-    rbm_abs_addr last_committed_record_base = 0;
     // start address where the newest record will be written
     rbm_abs_addr written_to = 0;
     // address to represent where last appllied record is written
@@ -240,7 +237,6 @@ public:
 
       denc(v.start_offset, p);
 
-      denc(v.last_committed_record_base, p);
       denc(v.written_to, p);
       denc(v.applied_to, p);
 
@@ -261,9 +257,9 @@ public:
    * Write position for CircularBoundedJournal
    *
    * | written to rbm |    written length to CircularBoundedJournal    | new write |
-   * ----------------->----------------------------------->------------>
-   *                  ^                                  ^            ^
-   *            applied_to              last_committed_record_base     written_to
+   * ----------------->------------------------------------------------>
+   *                  ^                                               ^
+   *            applied_to                                        written_to
    *
    */
 
@@ -286,7 +282,7 @@ public:
   void update_applied_to(rbm_abs_addr addr, uint32_t len) {
     rbm_abs_addr new_applied_to = addr;
     set_used_size(
-      get_last_committed_record_base() >= new_applied_to ?
+      get_written_to() >= new_applied_to ?
       get_written_to() - (new_applied_to + len) :
       get_written_to() + get_total_size() - (new_applied_to + len));
     set_applied_to(new_applied_to + len);
@@ -306,12 +302,6 @@ public:
   void set_written_to(rbm_abs_addr addr) {
     header.written_to = addr;
   }
-  rbm_abs_addr get_last_committed_record_base() const {
-    return header.last_committed_record_base;
-  }
-  void set_last_committed_record_base(rbm_abs_addr addr) {
-    header.last_committed_record_base = addr;
-  }
   rbm_abs_addr get_applied_to() const {
     return header.applied_to;
   }
index 0ec2cae4cecb500e6d8767b8c5f4372d9956e5fc..d66ec2cbcbd542b8d81fb467c3c7a104cb2ea610 100644 (file)
@@ -248,9 +248,6 @@ struct cbjournal_test_t : public seastar_test_suite_t
   auto get_written_to() {
     return cbj->get_written_to();
   }
-  auto get_last_committed_record_base() {
-    return cbj->get_last_committed_record_base();
-  }
   auto get_applied_to() {
     return cbj->get_applied_to();
   }
@@ -260,9 +257,6 @@ struct cbjournal_test_t : public seastar_test_suite_t
   void update_applied_to(rbm_abs_addr addr, uint32_t len) {
     cbj->update_applied_to(addr, len);
   }
-  void set_last_committed_record_base(rbm_abs_addr addr) {
-    cbj->set_last_committed_record_base(addr);
-  }
   void set_written_to(rbm_abs_addr addr) {
     cbj->set_written_to(addr);
   }
@@ -415,8 +409,6 @@ TEST_F(cbjournal_test_t, update_header)
     ASSERT_EQ(header.size, update_header.size);
     ASSERT_EQ(header.used_size, update_header.used_size);
     ASSERT_EQ(header.written_to + record_total_size, update_header.written_to);
-    ASSERT_EQ(header.last_committed_record_base + block_size,
-             update_header.last_committed_record_base);
   });
 }
 
@@ -475,15 +467,11 @@ TEST_F(cbjournal_test_t, replay_after_reset)
        });
     }
     auto old_written_to = get_written_to();
-    auto old_last_committed_record_base = get_last_committed_record_base();
     auto old_used_size = get_used_size();
     set_written_to(4096);
-    set_last_committed_record_base(4096);
     set_used_size(0);
     replay();
     ASSERT_EQ(old_written_to, get_written_to());
-    ASSERT_EQ(old_last_committed_record_base,
-      get_last_committed_record_base());
     ASSERT_EQ(old_used_size,
       get_used_size());
   });