]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore: rename *_super to *_header and use it as helper functions
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 9 Apr 2022 13:32:32 +0000 (22:32 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 19 May 2022 00:31:28 +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 cc45e933c4bb8966b58e003a3972f45900cd9515..738b5557fc9ab4fd8e349ae32800d05f63124d79 100644 (file)
@@ -66,7 +66,7 @@ CircularBoundedJournal::mkfs(const mkfs_config_t& config)
     DEBUG(
       "initialize header block in CircularBoundedJournal, length {}",
       bl.length());
-    return device_write_bl(start_addr, bl
+    return write_header(
     ).handle_error(
       mkfs_ertr::pass_further{},
       crimson::ct_error::assert_all{
@@ -98,7 +98,7 @@ CircularBoundedJournal::_open_device(const std::string path)
   );
 }
 
-ceph::bufferlist CircularBoundedJournal::encode_super()
+ceph::bufferlist CircularBoundedJournal::encode_header()
 {
   bufferlist bl;
   encode(header, bl);
@@ -112,14 +112,14 @@ CircularBoundedJournal::open_for_write_ret CircularBoundedJournal::open_for_writ
 
 CircularBoundedJournal::close_ertr::future<> CircularBoundedJournal::close()
 {
-  return write_super(
+  return write_header(
   ).safe_then([this]() -> close_ertr::future<> {
     init = false;
     return device->close();
   }).handle_error(
     open_for_write_ertr::pass_further{},
     crimson::ct_error::assert_all{
-      "Invalid error write_super"
+      "Invalid error write_header"
     }
   );
 }
@@ -141,15 +141,15 @@ CircularBoundedJournal::open_for_write(rbm_abs_addr start)
   }
   return _open_device(path
   ).safe_then([this, start, FNAME]() {
-    return read_super(start
+    return read_header(start
     ).handle_error(
       open_for_write_ertr::pass_further{},
       crimson::ct_error::assert_all{
-       "Invalid error read_super"
+       "Invalid error read_header"
     }).safe_then([this, FNAME](auto p) mutable {
       auto &[head, bl] = *p;
       header = head;
-      DEBUG("super : {}", header);
+      DEBUG("header : {}", header);
       paddr_t paddr = convert_abs_addr_to_paddr(
        get_written_to(),
        header.device_id);
@@ -324,16 +324,16 @@ CircularBoundedJournal::write_ertr::future<> CircularBoundedJournal::device_writ
   });
 }
 
-CircularBoundedJournal::read_super_ret
-CircularBoundedJournal::read_super(rbm_abs_addr start)
+CircularBoundedJournal::read_header_ret
+CircularBoundedJournal::read_header(rbm_abs_addr start)
 {
-  LOG_PREFIX(CircularBoundedJournal::read_super);
+  LOG_PREFIX(CircularBoundedJournal::read_header);
   auto bptr = bufferptr(ceph::buffer::create_page_aligned(
                        device->get_block_size()));
   return device->read(start, bptr
   ).safe_then([start, bptr, FNAME]() mutable
-    -> read_super_ret {
-    DEBUG("read_super: reading {}", start);
+    -> read_header_ret {
+    DEBUG("read_header: reading {}", start);
     bufferlist bl;
     bl.append(bptr);
     auto bp = bl.cbegin();
@@ -341,11 +341,11 @@ CircularBoundedJournal::read_super(rbm_abs_addr start)
     try {
       decode(cbj_header, bp);
     } catch (ceph::buffer::error &e) {
-      ERROR("read_super: unable to read super block");
+      ERROR("read_header: unable to read header block");
       return crimson::ct_error::enoent::make();
     }
-    return read_super_ret(
-      read_super_ertr::ready_future_marker{},
+    return read_header_ret(
+      read_header_ertr::ready_future_marker{},
       std::make_pair(cbj_header, bl)
     );
   });
@@ -562,14 +562,14 @@ CircularBoundedJournal::read_record_ret CircularBoundedJournal::read_record(padd
 }
 
 CircularBoundedJournal::write_ertr::future<>
-CircularBoundedJournal::write_super()
+CircularBoundedJournal::write_header()
 {
-  LOG_PREFIX(CircularBoundedJournal::write_super);
+  LOG_PREFIX(CircularBoundedJournal::write_header);
   ceph::bufferlist bl;
   try {
-    bl = encode_super();
+    bl = encode_header();
   } catch (ceph::buffer::error &e) {
-    DEBUG("unable to encode super block from underlying deivce");
+    DEBUG("unable to encode header block from underlying deivce");
     return crimson::ct_error::input_output_error::make();
   }
   DEBUG(
index 94b923bc9cd1e0f7072092f689ea01c1f612b5df..71282d412042f124b6e40cbf786f50f6dde5d415 100644 (file)
@@ -120,8 +120,8 @@ public:
   using read_record_ret = read_record_ertr::future<
        std::optional<std::pair<record_group_header_t, bufferlist>>
        >;
-  using read_super_ertr = read_ertr;
-  using read_super_ret = read_super_ertr::future<
+  using read_header_ertr = read_ertr;
+  using read_header_ret = read_header_ertr::future<
        std::optional<std::pair<cbj_header_t, bufferlist>>
        >;
   /*
@@ -134,16 +134,16 @@ public:
    */
   read_record_ret read_record(paddr_t offset);
   /*
-   * read_super
+   * read_header
    *
-   * read super block from given absolute address
+   * read header block from given absolute address
    *
    * @param absolute address
    *
    */
-  read_super_ret read_super(rbm_abs_addr start);
+  read_header_ret read_header(rbm_abs_addr start);
 
-  ceph::bufferlist encode_super();
+  ceph::bufferlist encode_header();
 
   using mkfs_ertr = crimson::errorator<
     crimson::ct_error::input_output_error,
@@ -269,7 +269,7 @@ public:
     set_applied_to(new_applied_to + len);
   }
 
-  write_ertr::future<> write_super();
+  write_ertr::future<> write_header();
 
   read_record_ret return_record(record_group_header_t& header, bufferlist bl);
 
index 13da9fc0a4071697cb0609d5eabc59340f74e0d2..af4b9dea0c02e0ef4efb27e61ca88fbf464d0942 100644 (file)
@@ -377,12 +377,12 @@ TEST_F(cbjournal_test_t, boudary_check_verify)
   });
 }
 
-TEST_F(cbjournal_test_t, update_super)
+TEST_F(cbjournal_test_t, update_header)
 {
   run_async([this] {
     mkfs();
     open();
-    auto [header, _buf] = *(cbj->read_super(0).unsafe_get0());
+    auto [header, _buf] = *(cbj->read_header(0).unsafe_get0());
     record_t rec {
      { generate_extent(1), generate_extent(2) },
      { generate_delta(20), generate_delta(21) }
@@ -391,15 +391,15 @@ TEST_F(cbjournal_test_t, update_super)
     auto record_total_size = r_size.get_encoded_length();
     submit_record(std::move(rec));
 
-    cbj->write_super().unsafe_get0();
-    auto [update_header, update_buf] = *(cbj->read_super(0).unsafe_get0());
+    cbj->write_header().unsafe_get0();
+    auto [update_header, update_buf] = *(cbj->read_header(0).unsafe_get0());
 
     ASSERT_EQ(header.size, update_header.size);
     ASSERT_EQ(header.used_size + record_total_size, update_header.used_size);
 
     update_applied_to(entries.front().addr, record_total_size);
-    cbj->write_super().unsafe_get0();
-    auto [update_header2, update_buf2] = *(cbj->read_super(0).unsafe_get0());
+    cbj->write_header().unsafe_get0();
+    auto [update_header2, update_buf2] = *(cbj->read_header(0).unsafe_get0());
 
     ASSERT_EQ(header.used_size, update_header2.used_size);
     ASSERT_EQ(header.written_to + record_total_size, update_header2.written_to);