NVMeBlockDevice::mount_ret NVMeBlockDevice::mount()
{
logger().debug(" mount ");
- return open(device_path, seastar::open_flags::rw | seastar::open_flags::dsync
- ).safe_then([this] {
- return stat_device(
- ).handle_error(
- mount_ertr::pass_further{},
- crimson::ct_error::assert_all{
- "Invalid error stat_device in RBMDevice::mount"}
- ).safe_then([this](auto st) {
- super.block_size = st.block_size;
- return read_rbm_header(RBM_START_ADDRESS
- ).safe_then([](auto s) {
- return seastar::now();
- });
- });
- }).handle_error(
- mount_ertr::pass_further{},
- crimson::ct_error::assert_all{
- "Invalid error mount in NVMeBlockDevice::mount"}
- );
+ return do_mount();
}
write_ertr::future<> NVMeBlockDevice::write(
});
}
+RBMDevice::mount_ret RBMDevice::do_mount()
+{
+ return open(get_device_path(),
+ seastar::open_flags::rw | seastar::open_flags::dsync
+ ).safe_then([this] {
+ return stat_device(
+ ).handle_error(
+ mount_ertr::pass_further{},
+ crimson::ct_error::assert_all{
+ "Invalid error stat_device in RBMDevice::mount"}
+ ).safe_then([this](auto st) {
+ super.block_size = st.block_size;
+ return read_rbm_header(RBM_START_ADDRESS
+ ).safe_then([](auto s) {
+ return seastar::now();
+ });
+ });
+ }).handle_error(
+ mount_ertr::pass_further{},
+ crimson::ct_error::assert_all{
+ "Invalid error mount in NVMeBlockDevice::mount"}
+ );
+}
+
EphemeralRBMDeviceRef create_test_ephemeral(uint64_t journal_size, uint64_t data_size) {
return EphemeralRBMDeviceRef(
new EphemeralRBMDevice(journal_size + data_size +
mkfs_ret do_mkfs(device_config_t);
+ mount_ret do_mount();
+
write_ertr::future<> write_rbm_header();
read_ertr::future<rbm_metadata_header_t> read_rbm_header(rbm_abs_addr addr);
extent_len_t get_block_size() const final { return block_size; }
mount_ret mount() final {
- return open("", seastar::open_flags::rw
- ).safe_then([this]() {
- super.block_size = TEST_BLOCK_SIZE;
- return read_rbm_header(RBM_START_ADDRESS
- ).safe_then([](auto s) {
- return seastar::now();
- });
- }).handle_error(
- mount_ertr::pass_further{},
- crimson::ct_error::assert_all{
- "Invalid error mount"
- }
- );
+ return do_mount();
}
mkfs_ret mkfs(device_config_t config) final {