diff --git a/src/crimson/os/seastore/journal/circular_bounded_journal.cc b/src/crimson/os/seastore/journal/circular_bounded_journal.cc index c671da32498..caedbcb461a 100644 --- a/src/crimson/os/seastore/journal/circular_bounded_journal.cc +++ b/src/crimson/os/seastore/journal/circular_bounded_journal.cc @@ -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()); diff --git a/src/crimson/os/seastore/journal/circular_bounded_journal.h b/src/crimson/os/seastore/journal/circular_bounded_journal.h index be67bf1d144..58f825d6217 100644 --- a/src/crimson/os/seastore/journal/circular_bounded_journal.h +++ b/src/crimson/os/seastore/journal/circular_bounded_journal.h @@ -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); diff --git a/src/test/crimson/seastore/test_cbjournal.cc b/src/test/crimson/seastore/test_cbjournal.cc index 9832add3e72..129fb7ae058 100644 --- a/src/test/crimson/seastore/test_cbjournal.cc +++ b/src/test/crimson/seastore/test_cbjournal.cc @@ -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); }); }