]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore/cbjournal: add assert(initialized), revmoving open_device_read_header()
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 13 May 2022 08:28:09 +0000 (17:28 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 19 May 2022 00:52:36 +0000 (09:52 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/journal/circular_bounded_journal.cc
src/test/crimson/seastore/transaction_manager_test_state.h

index 19bf019a3d5ba4ae9ec9845dd359504c96b8ec5f..cc44df9d46b874d7431862b30a74b990349e02b5 100644 (file)
@@ -102,18 +102,16 @@ ceph::bufferlist CircularBoundedJournal::encode_header()
 
 CircularBoundedJournal::open_for_write_ret CircularBoundedJournal::open_for_write()
 {
-  if (initialized) {
-    paddr_t paddr = convert_abs_addr_to_paddr(
-      get_written_to(),
-      header.device_id);
-    return open_for_write_ret(
-      open_for_write_ertr::ready_future_marker{},
-      journal_seq_t{
-       cur_segment_seq,
-       paddr
-      });
-  }
-  return open_device_read_header(CBJOURNAL_START_ADDRESS);
+  ceph_assert(initialized);
+  paddr_t paddr = convert_abs_addr_to_paddr(
+    get_written_to(),
+    header.device_id);
+  return open_for_write_ret(
+    open_for_write_ertr::ready_future_marker{},
+    journal_seq_t{
+      cur_segment_seq,
+      paddr
+  });
 }
 
 CircularBoundedJournal::close_ertr::future<> CircularBoundedJournal::close()
index 823d7b8305e84e5f410372a06259e14d06c22842..f30fe92cd0a5bd0b8097213f39a8b023adea3713 100644 (file)
@@ -208,10 +208,14 @@ protected:
       return static_cast<journal::CircularBoundedJournal*>(tm->get_journal())->mkfs(
        config
       ).safe_then([this]() {
-       return tm->mkfs(
-       ).handle_error(
-         crimson::ct_error::assert_all{"Error in mkfs"}
-       );
+       return static_cast<journal::CircularBoundedJournal*>(tm->get_journal())->
+         open_device_read_header(journal::CBJOURNAL_START_ADDRESS
+       ).safe_then([this](auto addr) {
+         return tm->mkfs(
+         ).handle_error(
+           crimson::ct_error::assert_all{"Error in mkfs"}
+         );
+       });
       }).handle_error(
        crimson::ct_error::assert_all{"Error in mkfs"}
       );