From: Yingxin Cheng Date: Wed, 23 Apr 2025 06:21:30 +0000 (+0800) Subject: crimson/os/seastore/seastore_types: adjust paddr_t::is_real_location() X-Git-Tag: v20.3.0~6^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=50a3fca25d64cafd3483a0fe50cf31dac57d7d0e;p=ceph.git crimson/os/seastore/seastore_types: adjust paddr_t::is_real_location() Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 53b23025cd665..2011dd3b2df5f 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -56,7 +56,7 @@ Cache::retire_extent_ret Cache::retire_extent_addr( LOG_PREFIX(Cache::retire_extent_addr); TRACET("retire {}~0x{:x}", t, paddr, length); - assert(paddr.is_real() && !paddr.is_block_relative()); + assert(paddr.is_real_location()); CachedExtentRef ext; auto result = t.get_extent(paddr, &ext); diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index 29bd7b9c85f12..33e08414e6b90 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -647,17 +647,6 @@ public: return get_device_id() == DEVICE_ID_ROOT; } - /** - * is_real - * - * indicates whether addr reflects a physical location, absolute, relative, - * or delayed. FAKE segments also count as real so as to reflect the way in - * which unit tests use them. - */ - bool is_real() const { - return !is_zero() && !is_null() && !is_root(); - } - bool is_absolute() const { return get_addr_type() != paddr_types_t::RESERVED; } @@ -666,6 +655,16 @@ public: return get_device_id() == DEVICE_ID_FAKE; } + /** + * is_real_location + * + * indicates whether addr reflects a real location (valid in lba) -- + * absolute, record-relative, or delayed. + */ + bool is_real_location() const { + return is_absolute() || is_delayed() || is_record_relative(); + } + auto operator<=>(const paddr_t &) const = default; DENC(paddr_t, v, p) { diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index e7d449cdd5e6d..0b8e27deb8816 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -213,7 +213,7 @@ public: ).si_then([this, FNAME, &t, offset, length, maybe_init=std::move(maybe_init)] (auto pin) mutable -> read_extent_ret { - if (length != pin->get_length() || !pin->get_val().is_real()) { + if (length != pin->get_length() || !pin->get_val().is_real_location()) { SUBERRORT(seastore_tm, "{}~0x{:x} {} got wrong pin {}", t, offset, length, T::TYPE, *pin); ceph_abort("Impossible"); @@ -240,7 +240,7 @@ public: ).si_then([this, FNAME, &t, offset, maybe_init=std::move(maybe_init)] (auto pin) mutable -> read_extent_ret { - if (!pin->get_val().is_real()) { + if (!pin->get_val().is_real_location()) { SUBERRORT(seastore_tm, "{} {} got wrong pin {}", t, offset, T::TYPE, *pin); ceph_abort("Impossible");