From 12b7a441dbe84bf96a6b1d50c4c8c9c872b9fc95 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Fri, 3 Apr 2026 11:25:20 +0000 Subject: [PATCH] crimson/seastore: avoid using 'final' to mean 'override' Note: when using 'final', the compiler *does not* check that the function is actually overriding a base class function. Using only 'override' wherever the class itself is already marked 'final', 'override final' otherwise. Signed-off-by: Ronen Friedman --- src/crimson/os/alienstore/alien_store.h | 64 +++++++++---------- src/crimson/os/cyanstore/cyan_store.h | 62 +++++++++--------- .../node_extent_manager/seastore.h | 2 +- .../random_block_manager/block_rb_manager.h | 36 +++++------ src/crimson/os/seastore/seastore.h | 62 +++++++++--------- .../os/seastore/segment_manager/block.h | 43 +++++++------ .../os/seastore/segment_manager/ephemeral.h | 42 ++++++------ src/crimson/os/seastore/segment_manager/zbd.h | 48 +++++++------- 8 files changed, 180 insertions(+), 179 deletions(-) diff --git a/src/crimson/os/alienstore/alien_store.h b/src/crimson/os/alienstore/alien_store.h index e712ce74d4e3..b0e17cac5248 100644 --- a/src/crimson/os/alienstore/alien_store.h +++ b/src/crimson/os/alienstore/alien_store.h @@ -27,50 +27,50 @@ public: AlienStore(const std::string& type, const std::string& path, const ConfigValues& values); - ~AlienStore() final; + ~AlienStore() override; - seastar::future start() final; - seastar::future<> stop() final; - mount_ertr::future<> mount() final; - seastar::future<> umount() final; + seastar::future start() override; + seastar::future<> stop() override; + mount_ertr::future<> mount() override; + seastar::future<> umount() override; base_errorator::future exists( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; - mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final; + uint32_t op_flags = 0) override; + mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) override; read_errorator::future read(CollectionRef c, const ghobject_t& oid, uint64_t offset, size_t len, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override; read_errorator::future readv(CollectionRef c, const ghobject_t& oid, interval_set& m, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override; get_attr_errorator::future get_attr( CollectionRef c, const ghobject_t& oid, std::string_view name, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override; get_attrs_ertr::future get_attrs( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override; read_errorator::future omap_get_values( CollectionRef c, const ghobject_t& oid, const omap_keys_t& keys, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override; seastar::future, ghobject_t>> list_objects( CollectionRef c, const ghobject_t& start, const ghobject_t& end, uint64_t limit, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override; read_errorator::future omap_iterate( CollectionRef c, @@ -78,51 +78,51 @@ public: ObjectStore::omap_iter_seek_t start_from, omap_iterate_cb_t callback, uint32_t op_flags = 0, - omap_iterate_conf_t on_conflict = nullptr) final; + omap_iterate_conf_t on_conflict = nullptr) override; - seastar::future create_new_collection(const coll_t& cid) final; - seastar::future open_collection(const coll_t& cid) final; - seastar::future> list_collections() final; + seastar::future create_new_collection(const coll_t& cid) override; + seastar::future open_collection(const coll_t& cid) override; + seastar::future> list_collections() override; seastar::future<> set_collection_opts(CollectionRef c, - const pool_opts_t& opts) final; + const pool_opts_t& opts) override; seastar::future<> do_transaction_no_callbacks( CollectionRef c, - ceph::os::Transaction&& txn) final; + ceph::os::Transaction&& txn) override; // error injection - seastar::future<> inject_data_error(const ghobject_t& o) final; - seastar::future<> inject_mdata_error(const ghobject_t& o) final; + seastar::future<> inject_data_error(const ghobject_t& o) override; + seastar::future<> inject_mdata_error(const ghobject_t& o) override; seastar::future<> write_meta(const std::string& key, - const std::string& value) final; + const std::string& value) override; seastar::future> read_meta( - const std::string& key) final; - uuid_d get_fsid() const final; - seastar::future stat() const final; - seastar::future pool_statfs(int64_t pool_id) const final; - unsigned get_max_attr_name_length() const final; + const std::string& key) override; + uuid_d get_fsid() const override; + seastar::future stat() const override; + seastar::future pool_statfs(int64_t pool_id) const override; + unsigned get_max_attr_name_length() const override; seastar::future stat( CollectionRef, const ghobject_t&, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override; seastar::future get_default_device_class() final; get_attr_errorator::future omap_get_header( CollectionRef, const ghobject_t&, - uint32_t) final; + uint32_t) override; read_errorator::future> fiemap( CollectionRef, const ghobject_t&, uint64_t off, uint64_t len, - uint32_t op_flags) final; + uint32_t op_flags) override; - BackendStore get_backend_store(store_index_t store_index) final { + BackendStore get_backend_store(store_index_t store_index) override { return BackendStore(*this, GLOBAL_STORE, store_index); } - FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) final { + FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) override { return *this; } diff --git a/src/crimson/os/cyanstore/cyan_store.h b/src/crimson/os/cyanstore/cyan_store.h index 53ea2576638b..06e1b9fb77ca 100644 --- a/src/crimson/os/cyanstore/cyan_store.h +++ b/src/crimson/os/cyanstore/cyan_store.h @@ -37,42 +37,42 @@ public: seastar::future stat( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; base_errorator::future exists( CollectionRef ch, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future read( CollectionRef c, const ghobject_t& oid, uint64_t offset, size_t len, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future readv( CollectionRef c, const ghobject_t& oid, interval_set& m, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; get_attr_errorator::future get_attr( CollectionRef c, const ghobject_t& oid, std::string_view name, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override final; get_attrs_ertr::future get_attrs( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future omap_get_values( CollectionRef c, const ghobject_t& oid, const omap_keys_t& keys, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future omap_iterate( CollectionRef c, @@ -81,12 +81,12 @@ public: omap_iterate_cb_t callback, uint32_t op_flags = 0, omap_iterate_conf_t on_conflict = nullptr - ) final; + ) override final; get_attr_errorator::future omap_get_header( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; seastar::future, ghobject_t>> list_objects( @@ -94,19 +94,19 @@ public: const ghobject_t& start, const ghobject_t& end, uint64_t limit, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override final; - seastar::future create_new_collection(const coll_t& cid) final; + seastar::future create_new_collection(const coll_t& cid) override final; - seastar::future open_collection(const coll_t& cid) final; + seastar::future open_collection(const coll_t& cid) override final; seastar::future<> set_collection_opts( CollectionRef c, - const pool_opts_t& opts) final; + const pool_opts_t& opts) override final; seastar::future<> do_transaction_no_callbacks( CollectionRef ch, - ceph::os::Transaction&& txn) final; + ceph::os::Transaction&& txn) override final; read_errorator::future> fiemap( @@ -114,9 +114,9 @@ public: const ghobject_t& oid, uint64_t off, uint64_t len, - uint32_t op_flags) final; + uint32_t op_flags) override final; - unsigned get_max_attr_name_length() const final; + unsigned get_max_attr_name_length() const override final; public: // only exposed to CyanStore @@ -195,28 +195,28 @@ public: }; CyanStore(const std::string& path); - ~CyanStore() final; + ~CyanStore() override; - seastar::future start() final; + seastar::future start() override; - seastar::future<> stop() final; + seastar::future<> stop() override; - mount_ertr::future<> mount() final; + mount_ertr::future<> mount() override; - seastar::future<> umount() final; + seastar::future<> umount() override; - mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final; + mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) override; - seastar::future stat() const final; + seastar::future stat() const override; - seastar::future pool_statfs(int64_t pool_id) const final; + seastar::future pool_statfs(int64_t pool_id) const override; - uuid_d get_fsid() const final; + uuid_d get_fsid() const override; seastar::future<> write_meta(const std::string& key, - const std::string& value) final; + const std::string& value) override; - BackendStore get_backend_store(store_index_t store_index) final { + BackendStore get_backend_store(store_index_t store_index) override { assert(!shard_stores.local().mshard_stores.empty()); if (store_index != NULL_STORE_INDEX) { assert(store_index < shard_stores.local().mshard_stores.size()); @@ -230,7 +230,7 @@ public: } } - FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) final + FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) override { assert(store_index < shard_stores.local().mshard_stores.size()); auto &shard_store = *(shard_stores.local().mshard_stores[store_index]); @@ -239,11 +239,11 @@ public: } seastar::future> - read_meta(const std::string& key) final; + read_meta(const std::string& key) override; - seastar::future> list_collections() final; + seastar::future> list_collections() override; - seastar::future get_default_device_class() final; + seastar::future get_default_device_class() override; seastar::future<> get_shard_nums(); diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h index 715b0b2ebe6d..dc5799382ba7 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h @@ -57,7 +57,7 @@ class SeastoreNodeExtent final: public NodeExtent { protected: NodeExtentRef mutate(context_t, DeltaRecorderURef&&) override; - void do_on_state_commit() final { + void do_on_state_commit() override { auto &prior = static_cast(*get_prior_instance()); prior.recorder = std::move(recorder); } diff --git a/src/crimson/os/seastore/random_block_manager/block_rb_manager.h b/src/crimson/os/seastore/random_block_manager/block_rb_manager.h index 553af02eed9c..46d2ce88aa50 100644 --- a/src/crimson/os/seastore/random_block_manager/block_rb_manager.h +++ b/src/crimson/os/seastore/random_block_manager/block_rb_manager.h @@ -42,10 +42,10 @@ public: * --------------------------------------------------------------------------- */ - read_ertr::future<> read(paddr_t addr, bufferptr &buffer) final; - write_ertr::future<> write(paddr_t addr, bufferptr buf) final; - open_ertr::future<> open() final; - close_ertr::future<> close() final; + read_ertr::future<> read(paddr_t addr, bufferptr &buffer) override; + write_ertr::future<> write(paddr_t addr, bufferptr buf) override; + open_ertr::future<> open() override; + close_ertr::future<> close() override; /* * alloc_extent @@ -55,19 +55,19 @@ public: * and freebitmap blocks. * */ - paddr_t alloc_extent(size_t size) final; // allocator, return blocks + paddr_t alloc_extent(size_t size) override; // allocator, return blocks - allocate_ret_bare alloc_extents(size_t size) final; // allocator, return blocks + allocate_ret_bare alloc_extents(size_t size) override; // allocator, return blocks - void complete_allocation(paddr_t addr, size_t size) final; + void complete_allocation(paddr_t addr, size_t size) override; size_t get_start_rbm_addr() const { return device->get_shard_journal_start() + device->get_journal_size(); } - size_t get_size() const final { + size_t get_size() const override { return device->get_shard_end() - get_start_rbm_addr(); }; - extent_len_t get_block_size() const final { return device->get_block_size(); } + extent_len_t get_block_size() const override { return device->get_block_size(); } BlockRBManager(RBMDevice * device, std::string path, bool detailed) : device(device), path(path) { @@ -76,24 +76,24 @@ public: write_ertr::future<> write(rbm_abs_addr addr, bufferlist &bl); - device_id_t get_device_id() const final { + device_id_t get_device_id() const override { assert(device); return device->get_device_id(); } - uint64_t get_free_blocks() const final { + uint64_t get_free_blocks() const override { // TODO: return correct free blocks after block allocator is introduced assert(device); return get_size() / get_block_size(); } - const seastore_meta_t &get_meta() const final { + const seastore_meta_t &get_meta() const override { return device->get_meta(); } RBMDevice* get_device() { return device; } - void mark_space_used(paddr_t paddr, size_t len) final { + void mark_space_used(paddr_t paddr, size_t len) override { assert(allocator); rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr); assert(addr >= get_start_rbm_addr() && @@ -101,7 +101,7 @@ public: allocator->mark_extent_used(addr, len); } - void mark_space_free(paddr_t paddr, size_t len) final { + void mark_space_free(paddr_t paddr, size_t len) override { assert(allocator); rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr); assert(addr >= get_start_rbm_addr() && @@ -109,13 +109,13 @@ public: allocator->free_extent(addr, len); } - paddr_t get_start() final { + paddr_t get_start() override { return convert_abs_addr_to_paddr( get_start_rbm_addr(), device->get_device_id()); } - rbm_extent_state_t get_extent_state(paddr_t paddr, size_t size) final { + rbm_extent_state_t get_extent_state(paddr_t paddr, size_t size) override { assert(allocator); rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr); assert(addr >= get_start_rbm_addr() && @@ -123,14 +123,14 @@ public: return allocator->get_extent_state(addr, size); } - size_t get_journal_size() const final { + size_t get_journal_size() const override { return device->get_journal_size(); } bool check_valid_range(rbm_abs_addr paddr, bufferptr &bptr); #ifdef UNIT_TESTS_BUILT - void prefill_fragmented_device() final; + void prefill_fragmented_device() override; #endif private: diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index cc3f5aa3533d..73e98ed8e936 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -102,42 +102,42 @@ public: seastar::future stat( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future read( CollectionRef c, const ghobject_t& oid, uint64_t offset, size_t len, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future readv( CollectionRef c, const ghobject_t& oid, interval_set& m, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; base_errorator::future exists( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; get_attr_errorator::future get_attr( CollectionRef c, const ghobject_t& oid, std::string_view name, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override final; get_attrs_ertr::future get_attrs( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future omap_get_values( CollectionRef c, const ghobject_t& oid, const omap_keys_t& keys, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; read_errorator::future omap_iterate( CollectionRef c, @@ -145,12 +145,12 @@ public: ObjectStore::omap_iter_seek_t start_from, omap_iterate_cb_t callback, uint32_t op_flags = 0, - omap_iterate_conf_t on_conflict = nullptr) final; + omap_iterate_conf_t on_conflict = nullptr) override final; get_attr_errorator::future omap_get_header( CollectionRef c, const ghobject_t& oid, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; /// std::get<1>(ret) returns end if and only if the listing has listed all /// the items within the range, otherwise it returns the next key to be listed. @@ -159,29 +159,29 @@ public: const ghobject_t& start, const ghobject_t& end, uint64_t limit, - uint32_t op_flags = 0) const final; + uint32_t op_flags = 0) const override final; - seastar::future create_new_collection(const coll_t& cid) final; - seastar::future open_collection(const coll_t& cid) final; + seastar::future create_new_collection(const coll_t& cid) override final; + seastar::future open_collection(const coll_t& cid) override final; seastar::future<> set_collection_opts(CollectionRef c, - const pool_opts_t& opts) final; + const pool_opts_t& opts) override final; seastar::future<> do_transaction_no_callbacks( CollectionRef ch, - ceph::os::Transaction&& txn) final; + ceph::os::Transaction&& txn) override final; /* Note, flush() machinery must go through the same pipeline * stages and locks as do_transaction. */ - seastar::future<> flush(CollectionRef ch) final; + seastar::future<> flush(CollectionRef ch) override final; read_errorator::future fiemap( CollectionRef ch, const ghobject_t& oid, uint64_t off, uint64_t len, - uint32_t op_flags = 0) final; + uint32_t op_flags = 0) override final; - unsigned get_max_attr_name_length() const final { + unsigned get_max_attr_name_length() const override final { return 256; } @@ -551,49 +551,49 @@ public: MDStoreRef mdstore); ~SeaStore(); - seastar::future start() final; - seastar::future<> stop() final; + seastar::future start() override; + seastar::future<> stop() override; Device::access_ertr::future<> _mount(); // FuturizedStore::mount_ertr/mkfs_ertr only supports a stateful_ec // to keep the interface intact, convert to stateful_ec. - crimson::os::FuturizedStore::mount_ertr::future<> mount() final { + crimson::os::FuturizedStore::mount_ertr::future<> mount() override { return _mount().handle_error( Device::access_ertr::all_same_way([](auto& code) { return crimson::stateful_ec{code}; })); } - seastar::future<> umount() final; + seastar::future<> umount() override; Device::access_ertr::future<> _mkfs(uuid_d new_osd_fsid); - crimson::os::FuturizedStore::mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final { + crimson::os::FuturizedStore::mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) override { return _mkfs(new_osd_fsid).handle_error( Device::access_ertr::all_same_way([](auto& code) { return crimson::stateful_ec{code}; })); } - seastar::future stat() const final; - seastar::future pool_statfs(int64_t pool_id) const final; + seastar::future stat() const override; + seastar::future pool_statfs(int64_t pool_id) const override; - seastar::future<> report_stats() final; + seastar::future<> report_stats() override; - uuid_d get_fsid() const final { + uuid_d get_fsid() const override { ceph_assert(seastar::this_shard_id() == primary_core); return shard_stores.local().mshard_stores[0]->get_fsid(); } - seastar::future<> write_meta(const std::string& key, const std::string& value) final; + seastar::future<> write_meta(const std::string& key, const std::string& value) override; - seastar::future> read_meta(const std::string& key) final; + seastar::future> read_meta(const std::string& key) override; - seastar::future> list_collections() final; + seastar::future> list_collections() override; seastar::future get_default_device_class() final; - BackendStore get_backend_store(store_index_t store_index) final { + BackendStore get_backend_store(store_index_t store_index) override { assert(!shard_stores.local().mshard_stores.empty()); if (store_index != NULL_STORE_INDEX) { assert(store_index < shard_stores.local().mshard_stores.size()); @@ -607,7 +607,7 @@ public: } } - FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) final + FuturizedStore::Shard& get_sharded_store(store_index_t store_index = 0) override { assert(store_index < shard_stores.local().mshard_stores.size()); auto &shard_store = *(shard_stores.local().mshard_stores[store_index]); diff --git a/src/crimson/os/seastore/segment_manager/block.h b/src/crimson/os/seastore/segment_manager/block.h index 515772e7736c..770284aad666 100644 --- a/src/crimson/os/seastore/segment_manager/block.h +++ b/src/crimson/os/seastore/segment_manager/block.h @@ -92,12 +92,12 @@ class BlockSegment final : public Segment { public: BlockSegment(BlockSegmentManager &manager, segment_id_t id); - segment_id_t get_segment_id() const final { return id; } - segment_off_t get_write_capacity() const final; - segment_off_t get_write_ptr() const final { return write_pointer; } - close_ertr::future<> close() final; - write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) final; - write_ertr::future<> advance_wp(segment_off_t offset) final; + segment_id_t get_segment_id() const override { return id; } + segment_off_t get_write_capacity() const override; + segment_off_t get_write_ptr() const override { return write_pointer; } + close_ertr::future<> close() override; + write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) override; + write_ertr::future<> advance_wp(segment_off_t offset) override; ~BlockSegment() {} }; @@ -112,15 +112,15 @@ public: class BlockSegmentManager final : public SegmentManager { // interfaces used by Device public: - seastar::future<> start(uint32_t shard_nums) final; + seastar::future<> start(uint32_t shard_nums) override; - seastar::future<> stop() final; + seastar::future<> stop() override; - Device& get_sharded_device(store_index_t store_index = 0) final; + Device& get_sharded_device(store_index_t store_index = 0) override; - mount_ret mount() final; + mount_ret mount() override; - mkfs_ret mkfs(device_config_t) final; + mkfs_ret mkfs(device_config_t) override; // interfaces used by each shard device public: close_ertr::future<> close(); @@ -137,23 +137,24 @@ public: ~BlockSegmentManager(); - open_ertr::future open(segment_id_t id) final; + open_ertr::future open(segment_id_t id) override; - release_ertr::future<> release(segment_id_t id) final; + release_ertr::future<> release(segment_id_t id) override; read_ertr::future<> read( paddr_t addr, size_t len, - ceph::bufferptr &out) final; + ceph::bufferptr &out) override; + read_ertr::future<> readv( - paddr_t addr, std::vector vecs) final; + paddr_t addr, std::vector vecs) override; - read_ertr::future get_shard_nums() final; + read_ertr::future get_shard_nums() override; - device_type_t get_device_type() const final { + device_type_t get_device_type() const override { return superblock.config.spec.dtype; } - size_t get_available_size() const final { + size_t get_available_size() const override { return shard_info.size; } extent_len_t get_block_size() const { @@ -163,11 +164,11 @@ public: return superblock.segment_size; } - device_id_t get_device_id() const final { + device_id_t get_device_id() const override { assert(device_id <= DEVICE_ID_MAX_VALID); return device_id; } - secondary_device_set_t& get_secondary_devices() final { + secondary_device_set_t& get_secondary_devices() override { return superblock.config.secondary_devices; } // public so tests can bypass segment interface when simpler @@ -176,7 +177,7 @@ public: ceph::bufferlist bl, bool ignore_check=false); - magic_t get_magic() const final { + magic_t get_magic() const override { return superblock.config.spec.magic; } diff --git a/src/crimson/os/seastore/segment_manager/ephemeral.h b/src/crimson/os/seastore/segment_manager/ephemeral.h index dc9580a11d5a..47735688d453 100644 --- a/src/crimson/os/seastore/segment_manager/ephemeral.h +++ b/src/crimson/os/seastore/segment_manager/ephemeral.h @@ -54,12 +54,12 @@ class EphemeralSegment final : public Segment { public: EphemeralSegment(EphemeralSegmentManager &manager, segment_id_t id); - segment_id_t get_segment_id() const final { return id; } - segment_off_t get_write_capacity() const final; - segment_off_t get_write_ptr() const final { return write_pointer; } - close_ertr::future<> close() final; - write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) final; - write_ertr::future<> advance_wp(segment_off_t offset) final; + segment_id_t get_segment_id() const override { return id; } + segment_off_t get_write_capacity() const override; + segment_off_t get_write_ptr() const override { return write_pointer; } + close_ertr::future<> close() override; + write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) override; + write_ertr::future<> advance_wp(segment_off_t offset) override; ~EphemeralSegment() {} }; @@ -71,7 +71,7 @@ class EphemeralSegmentManager final : public SegmentManager { const ephemeral_config_t config; std::optional device_config; - device_type_t get_device_type() const final { + device_type_t get_device_type() const override { assert(device_config); return device_config->spec.dtype; } @@ -97,55 +97,55 @@ public: ~EphemeralSegmentManager(); - close_ertr::future<> close() final { + close_ertr::future<> close() override { return close_ertr::now(); } - device_id_t get_device_id() const final { + device_id_t get_device_id() const override { assert(device_config); return device_config->spec.id; } - mount_ret mount() final { + mount_ret mount() override { return mount_ertr::now(); } - mkfs_ret mkfs(device_config_t) final; + mkfs_ret mkfs(device_config_t) override; - open_ertr::future open(segment_id_t id) final; + open_ertr::future open(segment_id_t id) override; - release_ertr::future<> release(segment_id_t id) final; + release_ertr::future<> release(segment_id_t id) override; read_ertr::future<> read( paddr_t addr, size_t len, - ceph::bufferptr &out) final; + ceph::bufferptr &out) override; read_ertr::future<> readv( paddr_t addr, - std::vector ptr) final; + std::vector ptr) override; - size_t get_available_size() const final { + size_t get_available_size() const override { return config.size; } - extent_len_t get_block_size() const final { + extent_len_t get_block_size() const override { return config.block_size; } - segment_off_t get_segment_size() const final { + segment_off_t get_segment_size() const override { return config.segment_size; } - const seastore_meta_t &get_meta() const final { + const seastore_meta_t &get_meta() const override { assert(device_config); return device_config->meta; } - secondary_device_set_t& get_secondary_devices() final { + secondary_device_set_t& get_secondary_devices() override { assert(device_config); return device_config->secondary_devices; } - magic_t get_magic() const final { + magic_t get_magic() const override { return device_config->spec.magic; } diff --git a/src/crimson/os/seastore/segment_manager/zbd.h b/src/crimson/os/seastore/segment_manager/zbd.h index 4e6976e4eba3..382223b138f7 100644 --- a/src/crimson/os/seastore/segment_manager/zbd.h +++ b/src/crimson/os/seastore/segment_manager/zbd.h @@ -101,12 +101,12 @@ namespace crimson::os::seastore::segment_manager::zbd { public: ZBDSegment(ZBDSegmentManager &man, segment_id_t i) : manager(man), id(i){}; - segment_id_t get_segment_id() const final { return id; } - segment_off_t get_write_capacity() const final; - segment_off_t get_write_ptr() const final { return write_pointer; } - close_ertr::future<> close() final; - write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) final; - write_ertr::future<> advance_wp(segment_off_t offset) final; + segment_id_t get_segment_id() const override { return id; } + segment_off_t get_write_capacity() const override; + segment_off_t get_write_ptr() const override { return write_pointer; } + close_ertr::future<> close() override; + write_ertr::future<> write(segment_off_t offset, ceph::bufferlist bl) override; + write_ertr::future<> advance_wp(segment_off_t offset) override; ~ZBDSegment() {} private: @@ -120,27 +120,27 @@ namespace crimson::os::seastore::segment_manager::zbd { class ZBDSegmentManager final : public SegmentManager{ // interfaces used by Device public: - seastar::future<> start(uint32_t shard_nums) final; + seastar::future<> start(uint32_t shard_nums) override; - seastar::future<> stop() final; + seastar::future<> stop() override; - Device& get_sharded_device(store_index_t store_index = 0) final; + Device& get_sharded_device(store_index_t store_index = 0) override; - mount_ret mount() final; - mkfs_ret mkfs(device_config_t meta) final; + mount_ret mount() override; + mkfs_ret mkfs(device_config_t meta) override; ZBDSegmentManager(const std::string &path, store_index_t store_index = 0) : device_path(path), store_index(store_index) {} - ~ZBDSegmentManager() final = default; + ~ZBDSegmentManager() override = default; //interfaces used by each shard device public: - open_ertr::future open(segment_id_t id) final; - close_ertr::future<> close() final; + open_ertr::future open(segment_id_t id) override; + close_ertr::future<> close() override; - release_ertr::future<> release(segment_id_t id) final; + release_ertr::future<> release(segment_id_t id) override; read_ertr::future<> read( paddr_t addr, @@ -148,23 +148,23 @@ namespace crimson::os::seastore::segment_manager::zbd { ceph::bufferptr &out) final; read_ertr::future<> readv( paddr_t addr, - std::vector ptrs) final; + std::vector ptrs) override; - read_ertr::future get_shard_nums() final; + read_ertr::future get_shard_nums() override; - device_type_t get_device_type() const final { + device_type_t get_device_type() const override { return device_type_t::ZBD; } - size_t get_available_size() const final { + size_t get_available_size() const override { return shard_info.size; }; - extent_len_t get_block_size() const final { + extent_len_t get_block_size() const override { return metadata.block_size; }; - segment_off_t get_segment_size() const final { + segment_off_t get_segment_size() const override { return metadata.segment_capacity; }; @@ -172,11 +172,11 @@ namespace crimson::os::seastore::segment_manager::zbd { return metadata.meta; }; - device_id_t get_device_id() const final; + device_id_t get_device_id() const override; - secondary_device_set_t& get_secondary_devices() final; + secondary_device_set_t& get_secondary_devices() override; - magic_t get_magic() const final; + magic_t get_magic() const override; Segment::write_ertr::future<> segment_write( paddr_t addr, -- 2.47.3