From 2bb39c50f3a99de91e893fe59ee4c7eb19a4979b Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 1 Aug 2024 14:59:35 +0800 Subject: [PATCH] crimson/os/seastore/cached_extent: cleanups and comments Signed-off-by: Yingxin Cheng --- src/crimson/os/seastore/cached_extent.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/crimson/os/seastore/cached_extent.h b/src/crimson/os/seastore/cached_extent.h index 1d6ffc740cb..e5e32b6713b 100644 --- a/src/crimson/os/seastore/cached_extent.h +++ b/src/crimson/os/seastore/cached_extent.h @@ -343,6 +343,8 @@ public: : "nullopt"; out << "CachedExtent(addr=" << this << ", type=" << get_type() + << ", trans=" << pending_for_transaction + << ", pending_io=" << is_pending_io() << ", version=" << version << ", dirty_from_or_retired_at=" << dirty_from_or_retired_at << ", modify_time=" << sea_time_point_printer_t{modify_time} @@ -440,14 +442,18 @@ public: state == extent_state_t::DIRTY; } + bool is_stable_writting() const { + // MUTATION_PENDING and under-io extents are already stable and visible, + // see prepare_record(). + // + // XXX: It might be good to mark this case as DIRTY from the definition, + // which probably can make things simpler. + return is_mutation_pending() && is_pending_io(); + } + /// Returns true if extent is stable and shared among transactions bool is_stable() const { - return is_stable_written() || - // MUTATION_PENDING and under-io extents are to-be-stable extents, - // for the sake of caveats that checks the correctness of extents - // states, we consider them stable. - (is_mutation_pending() && - is_pending_io()); + return is_stable_written() || is_stable_writting(); } bool is_data_stable() const { -- 2.39.5