From: Matan Breizman Date: Wed, 3 Dec 2025 13:02:27 +0000 (+0000) Subject: crimson/os/seastore: Introduce check_full_extent_integrity helper X-Git-Tag: testing/wip-pdonnell-testing-20260108.183402~5^2~5^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc04bef6218017dc6f9e726ef29575381b8773ff;p=ceph-ci.git crimson/os/seastore: Introduce check_full_extent_integrity helper This is an intermediate step to move the crc checks to Cache logic. Signed-off-by: Matan Breizman --- diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc index ca1a45af9a7..f62c8a774ba 100644 --- a/src/crimson/os/seastore/transaction_manager.cc +++ b/src/crimson/os/seastore/transaction_manager.cc @@ -625,6 +625,32 @@ TransactionManager::do_submit_transaction( ); } +void TransactionManager::check_full_extent_integrity( + Transaction &t, uint32_t ref_crc, uint32_t pin_crc) +{ + LOG_PREFIX(TransactionManager::check_full_extent_integrity); + SUBDEBUGT(seastore_tm, + "checksum in the lba tree: 0x{:x}, actual checksum: 0x{:x}", + t, + pin_crc, + ref_crc); + bool inconsistent = false; + if (full_extent_integrity_check) { + inconsistent = (pin_crc != ref_crc); + } else { // !full_extent_integrity_check: remapped extent may be skipped + inconsistent = !(pin_crc == 0 || + pin_crc == ref_crc); + } + if (unlikely(inconsistent)) { + SUBERRORT(seastore_tm, + "extent checksum inconsistent, recorded: 0x{:x}, actual: 0x{:x}", + t, + pin_crc, + ref_crc); + ceph_abort_msg("extent checksum inconsistent"); + } +} + seastar::future<> TransactionManager::flush(OrderingHandle &handle) { LOG_PREFIX(TransactionManager::flush); diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index 0a4b0ce36ad..884b8fe3f0c 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -1475,30 +1475,7 @@ private: } ).si_then([FNAME, &t, pin=pin, this](auto ref) mutable -> ret { if (ref->is_fully_loaded()) { - auto crc = ref->calc_crc32c(); - SUBTRACET( - seastore_tm, - "got extent -- {}, chksum in the lba tree: 0x{:x}, actual chksum: 0x{:x}", - t, - *ref, - pin.get_checksum(), - crc); - bool inconsistent = false; - if (full_extent_integrity_check) { - inconsistent = (pin.get_checksum() != crc); - } else { // !full_extent_integrity_check: remapped extent may be skipped - inconsistent = !(pin.get_checksum() == 0 || - pin.get_checksum() == crc); - } - if (unlikely(inconsistent)) { - SUBERRORT(seastore_tm, - "extent checksum inconsistent, recorded: 0x{:x}, actual: 0x{:x}, {}", - t, - pin.get_checksum(), - crc, - *ref); - ceph_abort(); - } + check_full_extent_integrity(t, ref->calc_crc32c(), pin.get_checksum()); } else { assert(!full_extent_integrity_check); } @@ -1508,6 +1485,9 @@ private: }); } + void check_full_extent_integrity( + Transaction &t, uint32_t ref_crc, uint32_t pin_crc); + /** * pin_to_extent_by_type * @@ -1557,22 +1537,7 @@ private: pin.get_checksum(), crc); assert(ref->is_fully_loaded()); - bool inconsistent = false; - if (full_extent_integrity_check) { - inconsistent = (pin.get_checksum() != crc); - } else { // !full_extent_integrity_check: remapped extent may be skipped - inconsistent = !(pin.get_checksum() == 0 || - pin.get_checksum() == crc); - } - if (unlikely(inconsistent)) { - SUBERRORT(seastore_tm, - "extent checksum inconsistent, recorded: 0x{:x}, actual: 0x{:x}, {}", - t, - pin.get_checksum(), - crc, - *ref); - ceph_abort(); - } + check_full_extent_integrity(t, ref->calc_crc32c(), pin.get_checksum()); return pin_to_extent_by_type_ret( interruptible::ready_future_marker{}, std::move(ref->template cast()));