]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore/cbjournal: move written_to from the header to CBJournal
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 13 May 2022 07:41:07 +0000 (16:41 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 19 May 2022 00:52:00 +0000 (09:52 +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 c671da32498d3fde2be3bf8620a57f0a72bde797..caedbcb461a257ea880d281e3e4c66d4520a1fa2 100644 (file)
@@ -21,7 +21,6 @@ std::ostream &operator<<(std::ostream &out,
             << ", size=" << header.size
             << ", journal_tail=" << header.journal_tail
             << ", applied_to="<< header.applied_to
-            << ", written_to=" << header.written_to
              << ")";
 }
 
@@ -43,12 +42,12 @@ CircularBoundedJournal::mkfs(const mkfs_config_t& config)
     head.block_size = config.block_size;
     head.size = config.total_size - device->get_block_size();
     head.journal_tail = device->get_block_size();
-    head.written_to = head.journal_tail;
     head.applied_to = head.journal_tail;
     head.device_id = config.device_id;
     start_dev_addr = config.start;
     encode(head, bl);
     header = head;
+    written_to = head.journal_tail;
     DEBUG(
       "initialize header block in CircularBoundedJournal, length {}",
       bl.length());
index be67bf1d144e8e9381e491983eb5768184da9689..58f825d62171ab1352499cd87b3130555ce57be7 100644 (file)
@@ -210,8 +210,6 @@ public:
 
     // start offset of CircularBoundedJournal in the device
     rbm_abs_addr journal_tail = 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
     rbm_abs_addr applied_to = 0;
 
@@ -226,7 +224,6 @@ public:
 
       denc(v.journal_tail, p);
 
-      denc(v.written_to, p);
       denc(v.applied_to, p);
 
       denc(v.device_id, p);
@@ -278,10 +275,10 @@ public:
   }
 
   rbm_abs_addr get_written_to() const {
-    return header.written_to;
+    return written_to;
   }
   void set_written_to(rbm_abs_addr addr) {
-    header.written_to = addr;
+    written_to = addr;
   }
   device_id_t get_device_id() const {
     return header.device_id;
@@ -309,6 +306,8 @@ private:
   bool init = false;
   segment_seq_t cur_segment_seq = 0; // segment seq to track the sequence to written records
   rbm_abs_addr start_dev_addr = 0; // cbjournal start address in device
+  // start address where the newest record will be written
+  rbm_abs_addr written_to = 0;
 };
 
 std::ostream &operator<<(std::ostream &out, const CircularBoundedJournal::cbj_header_t &header);
index 9832add3e725479e59efefb0fef66896d669e6f9..129fb7ae058d7daf64b87d940c543cde2b3a2118 100644 (file)
@@ -403,7 +403,6 @@ TEST_F(cbjournal_test_t, update_header)
     ASSERT_EQ(update_header.journal_tail, update_header.journal_tail);
     ASSERT_EQ(header.block_size, update_header.block_size);
     ASSERT_EQ(header.size, update_header.size);
-    ASSERT_EQ(header.written_to + record_total_size, update_header.written_to);
   });
 }