From bd5b1bb6b0db45556debf3ba103273565af15b41 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Fri, 24 Mar 2023 18:43:57 +0800 Subject: [PATCH] crimson/os/seastore/cache: consider EXIST_CLEAN extents as pending ones Signed-off-by: Xuehan Xu (cherry picked from commit f34faf363e69053d18d50263ee02ca5948b6462c) --- src/crimson/os/seastore/cache.cc | 2 +- src/crimson/os/seastore/cached_extent.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 97b60eb4006..243d1dffd03 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -995,7 +995,7 @@ CachedExtentRef Cache::duplicate_for_write( Transaction &t, CachedExtentRef i) { LOG_PREFIX(Cache::duplicate_for_write); - if (i->is_pending()) + if (i->is_mutable()) return i; if (i->is_exist_clean()) { diff --git a/src/crimson/os/seastore/cached_extent.h b/src/crimson/os/seastore/cached_extent.h index 29cfd687ae3..e4c3ec50f13 100644 --- a/src/crimson/os/seastore/cached_extent.h +++ b/src/crimson/os/seastore/cached_extent.h @@ -280,13 +280,17 @@ public: return TCachedExtentRef(static_cast(this)); } - /// Returns true if extent is part of an open transaction - bool is_pending() const { + bool is_mutable() const { return state == extent_state_t::INITIAL_WRITE_PENDING || state == extent_state_t::MUTATION_PENDING || state == extent_state_t::EXIST_MUTATION_PENDING; } + /// Returns true if extent is part of an open transaction + bool is_pending() const { + return is_mutable() || state == extent_state_t::EXIST_CLEAN; + } + /// Returns true if extent has a pending delta bool is_mutation_pending() const { return state == extent_state_t::MUTATION_PENDING; -- 2.39.5