From: Yingxin Cheng Date: Mon, 31 May 2021 02:11:01 +0000 (+0800) Subject: crimson/seastore: introduce TransactionManager::read_extent(t, offset) X-Git-Tag: v17.1.0~1674^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b6422b49a538103ee55c8ce2c269f15d63db641;p=ceph.git crimson/seastore: introduce TransactionManager::read_extent(t, offset) Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index 5a4cdb702e57..9f398c8a4008 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -214,6 +214,28 @@ public: }); } + /** + * read_extent + * + * Read extent of type T at offset + */ + template + read_extent_ret read_extent( + Transaction &t, + laddr_t offset) { + LOG_PREFIX(TransactionManager::read_extent); + return get_pin( + t, offset + ).safe_then([this, FNAME, &t, offset] (auto pin) { + if (!pin->get_paddr().is_real()) { + ERRORT("offset {} got wrong pin {}", + t, offset, *pin); + ceph_assert(0 == "Should be impossible"); + } + return this->pin_to_extent(t, std::move(pin)); + }); + } + /// Obtain mutable copy of extent LogicalCachedExtentRef get_mutable_extent(Transaction &t, LogicalCachedExtentRef ref) { LOG_PREFIX(TransactionManager::get_mutable_extent);