From: Matan Breizman Date: Tue, 29 Jul 2025 11:38:43 +0000 (+0000) Subject: crimson/os/seastore: SeaStore::mount() into coroutines X-Git-Tag: testing/wip-vshankar-testing-20250917.163544-debug~14^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3da1bd4fb1c22d6fcd5224ee98e3f6fbabfc38a7;p=ceph-ci.git crimson/os/seastore: SeaStore::mount() into coroutines The virtual FuturizedStore::mount() returns crimson::os::FuturizedStore::mount_ertr which is stateful_ec. Seastore's mount expectes a more complex ertr - access_ertr. In order to not handle each of seastore's errors and support the existing interface - convert the error into a stateful_ec. Signed-off-by: Matan Breizman --- diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 31a96368ca8..a00aed02e3b 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -270,51 +270,33 @@ SeaStore::mount_ertr::future<> SeaStore::test_mount() INFO("done"); } -SeaStore::mount_ertr::future<> SeaStore::mount() +Device::access_ertr::future<> SeaStore::_mount() { LOG_PREFIX(SeaStore::mount); INFO("..."); ceph_assert(seastar::this_shard_id() == primary_core); - return device->mount( - ).safe_then([this] { - ceph_assert(device->get_sharded_device().get_block_size() - >= laddr_t::UNIT_SIZE); - auto &sec_devices = device->get_sharded_device().get_secondary_devices(); - return crimson::do_for_each(sec_devices, [this](auto& device_entry) { - device_id_t id = device_entry.first; - magic_t magic = device_entry.second.magic; - device_type_t dtype = device_entry.second.dtype; - std::string path = - fmt::format("{}/block.{}.{}", root, dtype, std::to_string(id)); - return Device::make_device(path, dtype - ).then([this, path, magic](DeviceRef sec_dev) { - return sec_dev->start( - ).then([this, magic, sec_dev = std::move(sec_dev)]() mutable { - return sec_dev->mount( - ).safe_then([this, sec_dev=std::move(sec_dev), magic]() mutable { - ceph_assert(sec_dev->get_sharded_device().get_block_size() - >= laddr_t::UNIT_SIZE); - boost::ignore_unused(magic); // avoid clang warning; - assert(sec_dev->get_sharded_device().get_magic() == magic); - secondaries.emplace_back(std::move(sec_dev)); - }); - }).safe_then([this] { - return set_secondaries(); - }); - }); - }); - }).safe_then([this] { - return shard_stores.invoke_on_all([](auto &local_store) { - return local_store.mount_managers(); - }); - }).safe_then([FNAME] { - INFO("done"); - }).handle_error( - crimson::ct_error::assert_all{ - "Invalid error in SeaStore::mount" - } - ); + co_await device->mount(); + ceph_assert(device->get_sharded_device().get_block_size() >= laddr_t::UNIT_SIZE); + + auto &sec_devices = device->get_sharded_device().get_secondary_devices(); + for (auto& device_entry : sec_devices) { + device_id_t id = device_entry.first; + [[maybe_unused]] magic_t magic = device_entry.second.magic; + device_type_t dtype = device_entry.second.dtype; + std::string path = fmt::format("{}/block.{}.{}", root, dtype, std::to_string(id)); + DeviceRef sec_dev = co_await Device::make_device(path, dtype); + co_await sec_dev->start(); + co_await sec_dev->mount(); + ceph_assert(sec_dev->get_sharded_device().get_block_size() >= laddr_t::UNIT_SIZE); + assert(sec_dev->get_sharded_device().get_magic() == magic); + secondaries.emplace_back(std::move(sec_dev)); + co_await set_secondaries(); + } + co_await shard_stores.invoke_on_all([](auto &local_store) { + return local_store.mount_managers(); + }); + INFO("done"); } seastar::future<> SeaStore::Shard::mount_managers() diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index cc3eb187131..126958250d5 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -589,7 +589,16 @@ public: seastar::future<> start() final; seastar::future<> stop() final; - mount_ertr::future<> mount() final; + Device::access_ertr::future<> _mount(); + + // FuturizedStore::mount_ertr only supports a stateful_ec + // to keep the interface intact, convert to stateful_ec. + crimson::os::FuturizedStore::mount_ertr::future<> mount() final { + return _mount().handle_error( + Device::access_ertr::all_same_way([](auto& code) { + return crimson::stateful_ec{code}; + })); + } seastar::future<> umount() final; mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final;