From 569c480874aecd8b1b911ee9d40522dde494d414 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Tue, 13 Dec 2022 09:56:58 +0900 Subject: [PATCH] crimson/os/seastore: determine whether lba_backref_node can be allocated to OOL Signed-off-by: Myoungwon Oh Signed-off-by: Yingxin Cheng --- .../os/seastore/extent_placement_manager.cc | 6 --- .../os/seastore/extent_placement_manager.h | 41 +++++++++++++++---- src/crimson/os/seastore/seastore_types.h | 5 +++ src/crimson/os/seastore/transaction.h | 1 - 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/crimson/os/seastore/extent_placement_manager.cc b/src/crimson/os/seastore/extent_placement_manager.cc index 4ff9b8d9e14..518a64be59e 100644 --- a/src/crimson/os/seastore/extent_placement_manager.cc +++ b/src/crimson/os/seastore/extent_placement_manager.cc @@ -226,12 +226,6 @@ void ExtentPlacementManager::set_primary_device(Device *device) { ceph_assert(primary_device == nullptr); primary_device = device; - if (device->get_backend_type() == backend_type_t::SEGMENTED) { - prefer_ool = false; - } else { - ceph_assert(device->get_backend_type() == backend_type_t::RANDOM_BLOCK); - prefer_ool = true; - } ceph_assert(devices_by_id[device->get_device_id()] == device); } diff --git a/src/crimson/os/seastore/extent_placement_manager.h b/src/crimson/os/seastore/extent_placement_manager.h index 45e1f9b1e19..e4e59de0615 100644 --- a/src/crimson/os/seastore/extent_placement_manager.h +++ b/src/crimson/os/seastore/extent_placement_manager.h @@ -220,9 +220,13 @@ public: gen}; }; - if (!is_logical_type(type)) { - // TODO: implement out-of-line strategy for physical extent. - assert(get_extent_category(type) == data_category_t::METADATA); + if (type == extent_types_t::ROOT) { + return alloc_paddr(INLINE_GENERATION, data_category_t::METADATA, length); + } + + if (get_backend_type() == backend_type_t::SEGMENTED && + is_lba_backref_node(type)) { + // with SEGMENTED, lba-backref extents must be INLINE return alloc_paddr(INLINE_GENERATION, data_category_t::METADATA, length); } @@ -233,12 +237,16 @@ public: if (get_extent_category(type) == data_category_t::METADATA && gen == INIT_GENERATION) { - if (prefer_ool) { - return alloc_paddr(OOL_GENERATION, get_extent_category(type), length); - } else { - // default not to ool metadata extents to reduce padding overhead. - // TODO: improve padding so we can default to the prefer_ool path. + if (get_backend_type() == backend_type_t::SEGMENTED) { + // with SEGMENTED, default not to ool metadata extents to reduce + // padding overhead. + // TODO: improve padding so we can default to the ool path. return alloc_paddr(INLINE_GENERATION, get_extent_category(type), length); + } else { + // with RBM, all extents must be OOL + assert(get_backend_type() == + backend_type_t::RANDOM_BLOCK); + return alloc_paddr(OOL_GENERATION, get_extent_category(type), length); } } else { assert(get_extent_category(type) == data_category_t::DATA || @@ -336,6 +344,15 @@ public: background_process.release_projected_usage(usage); } + backend_type_t get_backend_type() const { + if (!background_process.is_no_background()) { + return background_process.get_backend_type(); + } + // for test + assert(primary_device); + return primary_device->get_backend_type(); + } + // Testing interfaces void test_init_no_background(Device *test_device) { @@ -470,6 +487,9 @@ private: } seastar::future<> stop_background(); + backend_type_t get_backend_type() const { + return get_journal_type(); + } // Testing interfaces @@ -478,6 +498,10 @@ private: } seastar::future<> run_until_halt(); + + bool is_no_background() const { + return !trimmer || !cleaner; + } protected: state_t get_state() const final { @@ -573,7 +597,6 @@ private: state_t state = state_t::STOP; }; - bool prefer_ool; std::vector writer_refs; std::vector data_writers_by_gen; // gen 0 METADATA writer is the journal writer diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index f4c83047ec7..8d1bace0eea 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -1113,6 +1113,11 @@ constexpr bool is_backref_node(extent_types_t type) type == extent_types_t::BACKREF_LEAF; } +constexpr bool is_lba_backref_node(extent_types_t type) +{ + return is_lba_node(type) || is_backref_node(type); +} + std::ostream &operator<<(std::ostream &out, extent_types_t t); /** diff --git a/src/crimson/os/seastore/transaction.h b/src/crimson/os/seastore/transaction.h index 11f1f6749d3..8899e105cef 100644 --- a/src/crimson/os/seastore/transaction.h +++ b/src/crimson/os/seastore/transaction.h @@ -158,7 +158,6 @@ public: delayed_alloc_list.emplace_back(ref->cast()); fresh_block_stats.increment(ref->get_length()); } else if (ref->get_paddr().is_absolute()) { - assert(ref->is_logical()); pre_alloc_list.emplace_back(ref->cast()); fresh_block_stats.increment(ref->get_length()); } else { -- 2.39.5