const std::string &path)
: trimmer(trimmer), device(device), path(path) {}
-CircularBoundedJournal::mkfs_ret CircularBoundedJournal::mkfs()
+ceph::bufferlist CircularBoundedJournal::encode_header()
+{
+ bufferlist bl;
+ encode(header, bl);
+ auto header_crc_filler = bl.append_hole(sizeof(checksum_t));
+ auto bliter = bl.cbegin();
+ auto header_crc = bliter.crc32c(
+ ceph::encoded_sizeof_bounded<cbj_header_t>(),
+ -1);
+ ceph_le32 header_crc_le;
+ header_crc_le = header_crc;
+ header_crc_filler.copy_in(
+ sizeof(checksum_t),
+ reinterpret_cast<const char *>(&header_crc_le));
+ return bl;
+}
+
+CircularBoundedJournal::open_for_mkfs_ret
+CircularBoundedJournal::open_for_mkfs()
{
- LOG_PREFIX(CircularBoundedJournal::mkfs);
+ LOG_PREFIX(CircularBoundedJournal::open_for_mkfs);
assert(device);
ceph::bufferlist bl;
CircularBoundedJournal::cbj_header_t head;
"initialize header block in CircularBoundedJournal, length {}",
bl.length());
return write_header(
- ).handle_error(
- mkfs_ertr::pass_further{},
+ ).safe_then([this]() {
+ return open_for_mount();
+ }).handle_error(
+ open_for_mkfs_ertr::pass_further{},
crimson::ct_error::assert_all{
- "Invalid error in CircularBoundedJournal::mkfs"
+ "Invalid error write_header"
}
);
}
-ceph::bufferlist CircularBoundedJournal::encode_header()
-{
- bufferlist bl;
- encode(header, bl);
- auto header_crc_filler = bl.append_hole(sizeof(checksum_t));
- auto bliter = bl.cbegin();
- auto header_crc = bliter.crc32c(
- ceph::encoded_sizeof_bounded<cbj_header_t>(),
- -1);
- ceph_le32 header_crc_le;
- header_crc_le = header_crc;
- header_crc_filler.copy_in(
- sizeof(checksum_t),
- reinterpret_cast<const char *>(&header_crc_le));
- return bl;
-}
-
-CircularBoundedJournal::open_for_mkfs_ret
-CircularBoundedJournal::open_for_mkfs()
-{
- return open_for_mount();
-}
-
CircularBoundedJournal::open_for_mount_ret
CircularBoundedJournal::open_for_mount()
{
}
virtual FuturizedStore::mkfs_ertr::future<> _mkfs() {
- if (journal_type == journal_type_t::SEGMENTED) {
- return tm->mkfs(
- ).handle_error(
- crimson::ct_error::assert_all{"Error in mkfs"}
- );
- } else {
- return static_cast<journal::CircularBoundedJournal*>(tm->get_journal())->mkfs(
- ).safe_then([this]() {
- return tm->mkfs(
- ).handle_error(
- crimson::ct_error::assert_all{"Error in mkfs"}
- );
- }).handle_error(
- crimson::ct_error::assert_all{"Error in mkfs"}
- );
- }
+ return tm->mkfs(
+ ).handle_error(
+ crimson::ct_error::assert_all{"Error in mkfs"}
+ );
}
auto create_mutate_transaction() {