From 0f6a1571b853dadf55774f5e6175bb47a43651b5 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Fri, 8 Oct 2021 10:24:26 +0800 Subject: [PATCH] crimson/os/seastore: rename ool_placement_hint_t To placement_hint_t as the hint is not limited to ool extents. Signed-off-by: Yingxin Cheng --- src/crimson/os/seastore/cached_extent.h | 2 +- src/crimson/os/seastore/extent_placement_manager.h | 13 +++++++------ src/crimson/os/seastore/seastore_types.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/crimson/os/seastore/cached_extent.h b/src/crimson/os/seastore/cached_extent.h index b60c19f84ed..83dd1df413e 100644 --- a/src/crimson/os/seastore/cached_extent.h +++ b/src/crimson/os/seastore/cached_extent.h @@ -328,7 +328,7 @@ public: device_type_t backend_type = device_type_t::NONE; /// hint for allocators - ool_placement_hint_t hint; + placement_hint_t hint = placement_hint_t::NUM_HINTS; bool is_inline() const { return poffset.is_relative(); diff --git a/src/crimson/os/seastore/extent_placement_manager.h b/src/crimson/os/seastore/extent_placement_manager.h index 5c55b9e1f72..2e368fb302d 100644 --- a/src/crimson/os/seastore/extent_placement_manager.h +++ b/src/crimson/os/seastore/extent_placement_manager.h @@ -252,7 +252,7 @@ public: Journal& journal, Cache& cache); - Writer &get_writer(ool_placement_hint_t hint) { + Writer &get_writer(placement_hint_t hint) { return writers[std::rand() % writers.size()]; } @@ -307,9 +307,10 @@ public: Transaction& t, extent_types_t type, segment_off_t length, - ool_placement_hint_t hint = ool_placement_hint_t::NONE) { + placement_hint_t hint = placement_hint_t::NONE) { // only logical extents should fall in this path assert(is_logical_type(type)); + assert(hint < placement_hint_t::NUM_HINTS); auto dtype = get_allocator_type(hint); CachedExtentRef extent; // for extents that would be stored in NVDIMM/PMEM, no delayed @@ -332,8 +333,8 @@ public: TCachedExtentRef alloc_new_extent( Transaction& t, segment_off_t length, - ool_placement_hint_t hint = ool_placement_hint_t::NONE) - { + placement_hint_t hint = placement_hint_t::NONE) { + assert(hint < placement_hint_t::NUM_HINTS); auto dtype = get_allocator_type(hint); TCachedExtentRef extent; if (need_delayed_allocation(dtype)) { @@ -413,7 +414,7 @@ public: } private: - device_type_t get_allocator_type(ool_placement_hint_t hint) { + device_type_t get_allocator_type(placement_hint_t hint) { return device_type_t::SEGMENTED; } @@ -423,7 +424,7 @@ private: ExtentAllocatorRef& get_allocator( device_type_t type, - ool_placement_hint_t hint) { + placement_hint_t hint) { auto& devices = allocators[type]; return devices[std::rand() % devices.size()]; } diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index b4184e01c69..1ccadaf964d 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -244,7 +244,7 @@ using objaddr_t = uint32_t; constexpr objaddr_t OBJ_ADDR_MAX = std::numeric_limits::max(); constexpr objaddr_t OBJ_ADDR_NULL = OBJ_ADDR_MAX - 1; -enum class ool_placement_hint_t { +enum class placement_hint_t { NONE, /// Denotes empty hint NUM_HINTS /// Constant for number of hints }; -- 2.39.5