diff --git a/src/llfs/confirm.hpp b/src/llfs/confirm.hpp index d50215c..58e89df 100644 --- a/src/llfs/confirm.hpp +++ b/src/llfs/confirm.hpp @@ -10,6 +10,8 @@ #ifndef LLFS_CONFIRM_HPP #define LLFS_CONFIRM_HPP +#include + namespace llfs { enum struct ConfirmThisWillEraseAllMyData : bool { @@ -17,6 +19,11 @@ enum struct ConfirmThisWillEraseAllMyData : bool { kYes = true, }; +inline std::ostream& operator<<(std::ostream& out, const ConfirmThisWillEraseAllMyData& t) +{ + return out << (bool)t; +} + } // namespace llfs #endif // LLFS_CONFIRM_HPP diff --git a/src/llfs/ioring_log_config.cpp b/src/llfs/ioring_log_config.cpp deleted file mode 100644 index a7d8328..0000000 --- a/src/llfs/ioring_log_config.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#include -// - -#ifndef LLFS_DISABLE_IO_URING - -#include -#include - -namespace llfs { - -//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - -// -/*static*/ IoRingLogConfig IoRingLogConfig::from_packed( - const FileOffsetPtr& packed_config) -{ - return IoRingLogConfig{ - .logical_size = packed_config->logical_size, - .physical_offset = packed_config.absolute_block_0_offset(), - .physical_size = packed_config->physical_size, - .pages_per_block_log2 = packed_config->pages_per_block_log2, - }; -} - -//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - -// -/*static*/ IoRingLogConfig IoRingLogConfig::from_logical_size(u64 logical_size, - Optional opt_block_size, - Optional opt_physical_offset) -{ - const usize block_size = opt_block_size.value_or(IoRingLogConfig::kDefaultBlockSize); - const i32 block_size_log2 = batt::log2_ceil(block_size); - - BATT_CHECK_GE(block_size_log2, kLogPageSizeLog2); - - return IoRingLogConfig{ - .logical_size = logical_size, - .physical_offset = opt_physical_offset.value_or(0), - .physical_size = - LogBlockCalculator::disk_size_required_for_log_size(logical_size, block_size), - .pages_per_block_log2 = block_size_log2 - kLogPageSizeLog2, - }; -} - -} // namespace llfs - -#endif // LLFS_DISABLE_IO_URING diff --git a/src/llfs/ioring_log_config.hpp b/src/llfs/ioring_log_config.hpp deleted file mode 100644 index fe3c49f..0000000 --- a/src/llfs/ioring_log_config.hpp +++ /dev/null @@ -1,110 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#pragma once -#ifndef LLFS_IORING_LOG_CONFIG_HPP -#define LLFS_IORING_LOG_CONFIG_HPP - -#include -#include -#include -#include -#include -#include - -namespace llfs { - -struct PackedLogDeviceConfig; - -//=#=#==#==#===============+=+=+=+=++=++++++++++++++-++-+--+-+----+--------------- -// Physical configuration of an IoRing-based LogDevice. -// -struct IoRingLogConfig { - static constexpr usize kDefaultBlockSize = 16 * kKiB; - static constexpr usize kDefaultPagesPerBlockLog2 = 5; - - static_assert((1ull << (kDefaultPagesPerBlockLog2 + kLogAtomicWriteSizeLog2)) == - kDefaultBlockSize, - ""); - - // The in-memory (logical) size in bytes of the log. - // - u64 logical_size; - - // The offset in bytes of the log from the beginning of the file. - // - i64 physical_offset; - - // The physical size in bytes of the log. - // - u64 physical_size; - - // Specifies the size of a "flush block," the size of a single write operation while flushing, - // in number of kLogAtomicWriteSize (default=512; see llfs/config.hpp) byte pages, log2. For - // example: - // - // | flush_block_pages_log2 | flush write buffer size | - // |--------------------------|---------------------------| - // | 0 | 512 | - // | 1 | 1kb | - // | 2 | 2kb | - // | 3 | 4kb | - // | 4 | 8kb | - // | 5 | 16kb | - // | 6 | 32kb | - // | 7 | 64kb | - // - usize pages_per_block_log2 = kDefaultPagesPerBlockLog2; - - //+++++++++++-+-+--+----- --- -- - - - - - - static IoRingLogConfig from_packed( - const FileOffsetPtr& packed_config); - - /** \brief Constructs and returns a config based on a given logical size. - * - * The block size defaults to IoRingLogConfig::kDefaultBlockSize. - * The physical offset defaults to 0. - * In all cases physical size is derived from logical size and block size. - * - * \return the new IoRingLogConfig - */ - static IoRingLogConfig from_logical_size(u64 logical_size, Optional opt_block_size = None, - Optional opt_physical_offset = None); - - //+++++++++++-+-+--+----- --- -- - - - - - - usize pages_per_block() const - { - return usize{1} << this->pages_per_block_log2; - } - - usize block_size() const - { - return kLogPageSize * this->pages_per_block(); - } - - usize block_capacity() const - { - return this->block_size() - sizeof(PackedLogPageHeader); - } - - usize block_count() const - { - BATT_CHECK_EQ(this->physical_size % this->block_size(), 0u) - << "The physical size of the log must be a multiple of the block size!" - << BATT_INSPECT(this->physical_size) << BATT_INSPECT(this->block_size()) - << BATT_INSPECT(this->pages_per_block_log2); - - return this->physical_size / this->block_size(); - } -}; - -} // namespace llfs - -#endif // LLFS_IORING_LOG_CONFIG_HPP diff --git a/src/llfs/ioring_log_config2.cpp b/src/llfs/ioring_log_config2.cpp index f55a8cc..720e356 100644 --- a/src/llfs/ioring_log_config2.cpp +++ b/src/llfs/ioring_log_config2.cpp @@ -11,6 +11,9 @@ #include +#include +#include + namespace llfs { //==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - @@ -27,4 +30,24 @@ namespace llfs { }; } +//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - +// +/*static*/ IoRingLogConfig2 IoRingLogConfig2::from_logical_size(u64 logical_size, + Optional opt_device_page_size, + Optional opt_data_alignment) +{ + const u64 device_page_size = opt_device_page_size.value_or(Self::kDefaultDevicePageSize); + const u64 data_alignment = opt_data_alignment.value_or(Self::kDefaultDataAlignment); + + const i32 device_page_size_log2 = batt::log2_ceil(device_page_size); + const i32 data_alignment_log2 = batt::log2_ceil(data_alignment); + + return IoRingLogConfig2{ + .control_block_offset = 0, + .log_capacity = batt::round_up_bits(data_alignment_log2, logical_size), + .device_page_size_log2 = BATT_CHECKED_CAST(u16, device_page_size_log2), + .data_alignment_log2 = BATT_CHECKED_CAST(u16, data_alignment_log2), + }; +} + } //namespace llfs diff --git a/src/llfs/ioring_log_config2.hpp b/src/llfs/ioring_log_config2.hpp index 02f1c5a..4108d73 100644 --- a/src/llfs/ioring_log_config2.hpp +++ b/src/llfs/ioring_log_config2.hpp @@ -15,16 +15,35 @@ #include #include -#include +#include namespace llfs { struct PackedLogDeviceConfig2; struct IoRingLogConfig2 { + using Self = IoRingLogConfig2; + + //+++++++++++-+-+--+----- --- -- - - - - + + static constexpr usize kDefaultDevicePageSize = 512; + static constexpr usize kDefaultDataAlignment = 4096; + + static constexpr u16 kDefaultDevicePageSizeLog2 = 9 /*=log2(512)*/; + static constexpr u16 kDefaultDataAlignmentLog2 = 12 /*=log2(4096)*/; + + static_assert((usize{1} << Self::kDefaultDevicePageSizeLog2) == Self::kDefaultDevicePageSize); + static_assert((usize{1} << Self::kDefaultDataAlignmentLog2) == Self::kDefaultDataAlignment); + + //+++++++++++-+-+--+----- --- -- - - - - + static IoRingLogConfig2 from_packed( const FileOffsetPtr& packed_config); + static IoRingLogConfig2 from_logical_size(u64 logical_size, + Optional opt_device_page_size = None, + Optional opt_data_alignment = None); + //+++++++++++-+-+--+----- --- -- - - - - i64 control_block_offset; @@ -38,6 +57,15 @@ struct IoRingLogConfig2 { { return i64{1} << this->data_alignment_log2; } + + Interval offset_range() const noexcept + { + return Interval{ + .lower_bound = this->control_block_offset, + .upper_bound = this->control_block_offset + this->control_block_size() + + static_cast(this->log_capacity), + }; + } }; } //namespace llfs diff --git a/src/llfs/ioring_log_device.cpp b/src/llfs/ioring_log_device.cpp deleted file mode 100644 index 60ccdd5..0000000 --- a/src/llfs/ioring_log_device.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#include -// - -#include - -#ifndef LLFS_DISABLE_IO_URING - -namespace llfs { - -} // namespace llfs - -#endif // LLFS_DISABLE_IO_URING diff --git a/src/llfs/ioring_log_device.hpp b/src/llfs/ioring_log_device.hpp deleted file mode 100644 index ccf79b2..0000000 --- a/src/llfs/ioring_log_device.hpp +++ /dev/null @@ -1,115 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#pragma once -#ifndef LLFS_IORING_LOG_DEVICE_HPP -#define LLFS_IORING_LOG_DEVICE_HPP - -#include - -#ifndef LLFS_DISABLE_IO_URING - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace llfs { - -using IoRingLogDevice = BasicRingBufferLogDevice; - -//=#=#==#==#===============+=+=+=+=++=++++++++++++++-++-+--+-+----+--------------- - -class IoRingLogDeviceFactory : public LogDeviceFactory -{ - public: - explicit IoRingLogDeviceFactory(batt::TaskScheduler& task_scheduler, int fd, - const FileOffsetPtr& packed_config, - const IoRingLogDriverOptions& options) noexcept - : IoRingLogDeviceFactory{task_scheduler, fd, IoRingLogConfig::from_packed(packed_config), - options} - { - } - - explicit IoRingLogDeviceFactory(batt::TaskScheduler& task_scheduler, int fd, - const IoRingLogConfig& config, - const IoRingLogDriverOptions& options) noexcept - : task_scheduler_{task_scheduler} - , fd_{fd} - , config_{config} - , options_{options} - { - } - - ~IoRingLogDeviceFactory() noexcept - { - if (this->fd_ != -1) { - ::close(this->fd_); - } - } - - StatusOr> open_ioring_log_device() - { - LogBlockCalculator calculate{this->config_, this->options_}; - - BATT_ASSIGN_OK_RESULT(DefaultIoRingLogDeviceStorage storage, - DefaultIoRingLogDeviceStorage::make_new( - MaxQueueDepth{ - calculate.queue_depth() * 2 - // - // Double the number of flush ops, to give us some margin so the - // rings don't ever run out of space (TODO [tastolfi 2024-05-14] - // this seems excessive; investigate lowering this) - }, - this->fd_)); - - this->fd_ = -1; - - auto instance = std::make_unique( - RingBuffer::TempFile{.byte_size = this->config_.logical_size}, this->task_scheduler_, - std::move(storage), this->config_, this->options_); - - Status open_status = instance->open(); - BATT_REQUIRE_OK(open_status); - - return instance; - } - - StatusOr> open_log_device(const LogScanFn& scan_fn) override - { - auto instance = this->open_ioring_log_device(); - BATT_REQUIRE_OK(instance); - - auto scan_status = - scan_fn(*(*instance)->new_reader(/*slot_lower_bound=*/None, LogReadMode::kDurable)); - BATT_REQUIRE_OK(scan_status); - - return instance; - } - - private: - batt::TaskScheduler& task_scheduler_; - int fd_; - IoRingLogConfig config_; - IoRingLogDriverOptions options_; -}; - -} // namespace llfs - -#endif // LLFS_DISABLE_IO_URING -#endif // LLFS_IORING_LOG_DEVICE_HPP diff --git a/src/llfs/ioring_log_device.test.cpp b/src/llfs/ioring_log_device.test.cpp deleted file mode 100644 index 9e3caa2..0000000 --- a/src/llfs/ioring_log_device.test.cpp +++ /dev/null @@ -1,257 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#include -// -#include - -#ifndef LLFS_DISABLE_IO_URING - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -namespace { - -using namespace batt::int_types; -using namespace batt::constants; - -auto constexpr kLogDeviceFileName = "/tmp/llfs_IoringLogDeviceTest_StorageFile.llfs"; - -constexpr usize kLogTotalSize = 16 * kKiB; -constexpr usize kLogBlockSize = 1 * kKiB; -constexpr usize kLogBlockCapacity = 960; -constexpr usize kLogPagesPerBlockLog2 = 1; - -BATT_STATIC_ASSERT_EQ(kLogBlockSize, (usize{1} << kLogPagesPerBlockLog2) * llfs::kLogPageSize); - -TEST(IoringLogDeviceTest, StorageFile) -{ - for (usize amount_to_write : - {usize{1}, kLogBlockCapacity / 2, kLogBlockCapacity, kLogTotalSize}) { - const std::filesystem::path kLogDeviceFilePath = kLogDeviceFileName; - - boost::uuids::uuid test_log_uuid = llfs::random_uuid(); - - auto scoped_ioring = - llfs::ScopedIoRing::make_new(llfs::MaxQueueDepth{256}, llfs::ThreadPoolSize{1}); - - ASSERT_TRUE(scoped_ioring.ok()) << BATT_INSPECT(scoped_ioring.status()); - - auto storage_context = batt::make_shared( - batt::Runtime::instance().default_scheduler(), scoped_ioring->get_io_ring()); - - // Remove the file if it already exists. - // - std::filesystem::remove_all(kLogDeviceFilePath); - ASSERT_TRUE(!std::filesystem::exists(kLogDeviceFilePath)); - - // Create a log device file. - // - batt::Status add_file_status = storage_context->add_new_file( - kLogDeviceFilePath, [&](llfs::StorageFileBuilder& builder) -> batt::Status { - BATT_REQUIRE_OK(builder.add_object(llfs::LogDeviceConfigOptions{ - .uuid = test_log_uuid, - .pages_per_block_log2 = kLogPagesPerBlockLog2, - .log_size = kLogTotalSize, - })); - - return batt::OkStatus(); - }); - - ASSERT_TRUE(add_file_status.ok()) << BATT_INSPECT(add_file_status); - - { - // Recover the log config from the file. - // - batt::StatusOr> log_device_factory = - storage_context->recover_object(batt::StaticType{}, - test_log_uuid, - llfs::IoRingLogDriverOptions::with_default_values() - .set_name("test_log") - .set_queue_depth(2)); - - ASSERT_TRUE(log_device_factory.ok()) << BATT_INSPECT(log_device_factory.status()); - - { - // Open the log using the recovered config. - // - batt::StatusOr> status_or_log_device = - (**log_device_factory).open_ioring_log_device(); - ASSERT_TRUE(status_or_log_device.ok()) << BATT_INSPECT(status_or_log_device.status()); - - llfs::IoRingLogDevice& log_device = **status_or_log_device; - - llfs::IoRingLogDriver& driver = log_device.driver().impl(); - EXPECT_EQ(driver.calculate().block_capacity(), kLogBlockCapacity); - - // Append some data. - // - llfs::LogDevice::Writer& writer = log_device.writer(); - - batt::StatusOr dst_buffer = writer.prepare(amount_to_write); - ASSERT_TRUE(dst_buffer.ok()) << BATT_INSPECT(dst_buffer.status()); - ASSERT_GE(dst_buffer->size(), amount_to_write); - - std::memset(dst_buffer->data(), 'a', amount_to_write); - - batt::StatusOr commit_status = writer.commit(amount_to_write); - ASSERT_TRUE(commit_status.ok()) << BATT_INSPECT(commit_status); - - batt::Status sync_status = - log_device.sync(llfs::LogReadMode::kDurable, llfs::SlotUpperBoundAt{amount_to_write}); - ASSERT_TRUE(sync_status.ok()) << BATT_INSPECT(sync_status); - - // Close the device. - // - batt::Status close_status = log_device.close(); - ASSERT_TRUE(close_status.ok()) << BATT_INSPECT(close_status); - } - } - - // Re-open the log. - // - { - // Recover the log config from the file. - // - batt::StatusOr> log_device_factory = - storage_context->recover_object(batt::StaticType{}, - test_log_uuid, - llfs::IoRingLogDriverOptions::with_default_values() - .set_name("test_log") - .set_queue_depth(2)); - - ASSERT_TRUE(log_device_factory.ok()) << BATT_INSPECT(log_device_factory.status()); - - { - // Open the log using the recovered config. - // - batt::StatusOr> status_or_log_device = - (**log_device_factory).open_ioring_log_device(); - - ASSERT_TRUE(status_or_log_device.ok()) << BATT_INSPECT(status_or_log_device.status()); - } - } - } -} - -//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - -// -/** \brief Runs a LogDevice flush throughput microbenchmark. - * - * This is normally disabled; to enable it, define the env var LLFS_LOG_DEVICE_FILE to specify where - * to create the llfs storage file that will contain the log device. - * - * The benchmark behavior is configured via env vars. The basic workload is to create the storage - * file with a log device of the specified size (LLFS_LOG_DEVICE_SIZE_KB) and pages per block - * (LLFS_LOG_DEVICE_PAGES_PER_BLOCK), then launch two threads, an appender and a trimmer. - * - * The appender thread will write records of size LLFS_LOG_DEVICE_APPEND_SIZE bytes until it has - * successfully appended a total of LLFS_LOG_DEVICE_WRITE_KB kilobytes worth of data. Then the - * appender waits for flush to complete, halts the LogDevice, and exits. - * - * The trimmer thread waits until the amount of active data in the log is at least - * LLFS_LOG_DEVICE_TRIM_TRIGGER bytes, then trims exactly LLFS_LOG_DEVICE_TRIM_SIZE bytes, looping - * until an error is encountered. Under normal circumstances, this will happen when the appender - * thread has finished and has halted the LogDevice. - */ -TEST(IoringLogDeviceTest, Benchmark) -{ - using llfs::read_test_var; - - const char* file_name = // - std::getenv("LLFS_LOG_DEVICE_FILE"); - - if (!file_name) { - LLFS_LOG_INFO() << "LLFS_LOG_DEVICE_FILE not specified; skipping benchmark test"; - return; - } - - std::cout << "LLFS_LOG_DEVICE_FILE=" << batt::c_str_literal(file_name) << std::endl; - - //+++++++++++-+-+--+----- --- -- - - - - - - const usize queue_depth = read_test_var("LLFS_STORAGE_CONTEXT_QUEUE_DEPTH", usize{64}); - const usize thread_pool_size = read_test_var("LLFS_STORAGE_CONTEXT_THREADS", usize{1}); - const usize pages_per_block = read_test_var("LLFS_LOG_DEVICE_PAGES_PER_BLOCK", usize{32}); - const usize log_queue_depth = read_test_var("LLFS_LOG_DEVICE_QUEUE_DEPTH", usize{1024}); - - //+++++++++++-+-+--+----- --- -- - - - - - - llfs::run_log_device_benchmark([&](usize log_size, bool create, auto&& consume_log_fn) { - BATT_CHECK(create); - - auto scoped_ioring = llfs::ScopedIoRing::make_new(llfs::MaxQueueDepth{queue_depth}, - llfs::ThreadPoolSize{thread_pool_size}); - - ASSERT_TRUE(scoped_ioring.ok()) << BATT_INSPECT(scoped_ioring.status()); - - auto storage_context = batt::make_shared( - batt::Runtime::instance().default_scheduler(), scoped_ioring->get_io_ring()); - - // Remove the file if it already exists. - // - std::filesystem::path file_path{file_name}; - std::filesystem::remove_all(file_path); - ASSERT_FALSE(std::filesystem::exists(file_path)); - - // Create a log device file. - // - const boost::uuids::uuid test_log_uuid = llfs::random_uuid(); - - batt::Status add_file_status = storage_context->add_new_file( - file_path, [&](llfs::StorageFileBuilder& builder) -> batt::Status { - BATT_REQUIRE_OK(builder.add_object(llfs::LogDeviceConfigOptions{ - .uuid = test_log_uuid, - .pages_per_block_log2 = batt::log2_ceil(pages_per_block), - .log_size = log_size, - })); - - return batt::OkStatus(); - }); - - ASSERT_TRUE(add_file_status.ok()) << BATT_INSPECT(add_file_status); - - // Recover the log config from the file. - // - batt::StatusOr> log_device_factory = - storage_context->recover_object(batt::StaticType{}, - test_log_uuid, - llfs::IoRingLogDriverOptions::with_default_values() - .set_name("test_log") - .set_queue_depth(log_queue_depth)); - - // Open the log using the recovered config. - // - batt::StatusOr> status_or_log_device = - (**log_device_factory).open_ioring_log_device(); - - ASSERT_TRUE(status_or_log_device.ok()) << BATT_INSPECT(status_or_log_device.status()); - - llfs::IoRingLogDevice& log_device = **status_or_log_device; - - // Run the workload. - // - consume_log_fn(log_device); - }); -} - -} // namespace - -#endif // LLFS_DISABLE_IO_URING diff --git a/src/llfs/ioring_log_device2.cpp b/src/llfs/ioring_log_device2.cpp index bb852e7..0c44ac6 100644 --- a/src/llfs/ioring_log_device2.cpp +++ b/src/llfs/ioring_log_device2.cpp @@ -13,8 +13,13 @@ namespace llfs { //==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - - // -Status initialize_log_device2(RawBlockFile& file, const IoRingLogConfig2& config) +Status initialize_log_device2(RawBlockFile& file, const IoRingLogConfig2& config, + ConfirmThisWillEraseAllMyData confirm) { + if (confirm != ConfirmThisWillEraseAllMyData::kYes) { + return ::llfs::make_status(::llfs::StatusCode::kFileLogEraseNotConfirmed); + } + using AlignedUnit = std::aligned_storage_t; const usize device_page_size = usize{1} << config.device_page_size_log2; diff --git a/src/llfs/ioring_log_device2.hpp b/src/llfs/ioring_log_device2.hpp index ef1c151..6f54cbc 100644 --- a/src/llfs/ioring_log_device2.hpp +++ b/src/llfs/ioring_log_device2.hpp @@ -13,6 +13,7 @@ #include // #include +#include #include #include #include @@ -39,7 +40,8 @@ BATT_STRONG_TYPEDEF(slot_offset_type, CommitPos); /** \brief Initializes an IoRingLogDevice2 using the given storage device and configuration (which * includes offset within the passed device). */ -Status initialize_log_device2(RawBlockFile& file, const IoRingLogConfig2& config); +Status initialize_log_device2(RawBlockFile& file, const IoRingLogConfig2& config, + ConfirmThisWillEraseAllMyData confirm); template class IoRingLogDriver2 diff --git a/src/llfs/ioring_log_device2.test.cpp b/src/llfs/ioring_log_device2.test.cpp index 533bad0..b7a4bca 100644 --- a/src/llfs/ioring_log_device2.test.cpp +++ b/src/llfs/ioring_log_device2.test.cpp @@ -171,7 +171,8 @@ class IoringLogDevice2SimTest : public ::testing::Test ASSERT_FALSE(storage.is_initialized()); Status init_status = - llfs::initialize_log_device2(*storage.get_raw_block_file(), this->log_config); + llfs::initialize_log_device2(*storage.get_raw_block_file(), this->log_config, + llfs::ConfirmThisWillEraseAllMyData::kYes); ASSERT_TRUE(init_status.ok()) << BATT_INSPECT(init_status); @@ -643,7 +644,8 @@ TEST(IoringLogDevice2Test, Benchmark) //+++++++++++-+-+--+----- --- -- - - - - // Write the initial contents of the file. // - llfs::Status init_status = llfs::initialize_log_device2(file, config); + llfs::Status init_status = + llfs::initialize_log_device2(file, config, llfs::ConfirmThisWillEraseAllMyData::kYes); ASSERT_TRUE(init_status.ok()) << BATT_INSPECT(init_status); } diff --git a/src/llfs/ioring_log_driver.cpp b/src/llfs/ioring_log_driver.cpp deleted file mode 100644 index 2544b2e..0000000 --- a/src/llfs/ioring_log_driver.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#include -// - -#ifndef LLFS_DISABLE_IO_URING - -#include - -namespace llfs { - -template class BasicIoRingLogDriver; - -} // namespace llfs - -#endif // LLFS_DISABLE_IO_URING diff --git a/src/llfs/ioring_log_driver.hpp b/src/llfs/ioring_log_driver.hpp deleted file mode 100644 index 25a32fb..0000000 --- a/src/llfs/ioring_log_driver.hpp +++ /dev/null @@ -1,357 +0,0 @@ -//#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++ -// -// Part of the LLFS Project, under Apache License v2.0. -// See https://www.apache.org/licenses/LICENSE-2.0 for license information. -// SPDX short identifier: Apache-2.0 -// -//+++++++++++-+-+--+----- --- -- - - - - - -#pragma once -#ifndef LLFS_IORING_LOG_DRIVER_HPP -#define LLFS_IORING_LOG_DRIVER_HPP - -#include -// - -#ifndef LLFS_DISABLE_IO_URING - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -BATT_SUPPRESS("-Wunused-parameter") - -#include -#include - -BATT_UNSUPPRESS() - -#include -#include -#include - -namespace llfs { - -using IoRingLogDriver = BasicIoRingLogDriver; - -//=#=#==#==#===============+=+=+=+=++=++++++++++++++-++-+--+-+----+--------------- -// -template