summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYingxin <yingxin.cheng@intel.com>2024-11-29 04:25:22 +0100
committerGitHub <noreply@github.com>2024-11-29 04:25:22 +0100
commit739139b7de6e321b936cf9231ea535331ba9715b (patch)
tree34af0e1748c50333530659c33a14cae904899c9e
parentMerge pull request #60427 from mkogan1/wip-vstart-dev-err (diff)
parentcrimson/os/seastore/transaction_manager: add log in get_extents_if_live() (diff)
downloadceph-739139b7de6e321b936cf9231ea535331ba9715b.tar.xz
ceph-739139b7de6e321b936cf9231ea535331ba9715b.zip
Merge pull request #60817 from cyx1231st/wip-seastore-improve-get_extents_if_live
crimson/os/seastore/transaction_manager: improve get_extents_if_live() Reviewed-by: Xuehan Xu <xuxuehan@qianxin.com>
-rw-r--r--src/crimson/os/seastore/transaction_manager.cc27
-rw-r--r--src/crimson/os/seastore/transaction_manager.h6
2 files changed, 21 insertions, 12 deletions
diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc
index 5d7b21fa443..745df70235b 100644
--- a/src/crimson/os/seastore/transaction_manager.cc
+++ b/src/crimson/os/seastore/transaction_manager.cc
@@ -726,7 +726,7 @@ TransactionManager::get_extents_if_live(
ceph_assert(paddr.get_addr_type() == paddr_types_t::SEGMENT);
return cache->get_extent_if_cached(t, paddr, type
- ).si_then([=, this, &t](auto extent)
+ ).si_then([this, FNAME, type, paddr, laddr, len, &t](auto extent)
-> get_extents_if_live_ret {
if (extent && extent->get_length() == len) {
DEBUGT("{} {}~0x{:x} {} is cached and alive -- {}",
@@ -743,19 +743,24 @@ TransactionManager::get_extents_if_live(
t,
laddr,
len
- ).si_then([=, this, &t](lba_pin_list_t pin_list) {
+ ).si_then([this, FNAME, type, paddr, laddr, len, &t](lba_pin_list_t pin_list) {
return seastar::do_with(
std::list<CachedExtentRef>(),
- [=, this, &t, pin_list=std::move(pin_list)](
- std::list<CachedExtentRef> &list) mutable
+ std::move(pin_list),
+ [this, FNAME, type, paddr, laddr, len, &t]
+ (std::list<CachedExtentRef> &extent_list, auto& pin_list)
{
auto paddr_seg_id = paddr.as_seg_paddr().get_segment_id();
return trans_intr::parallel_for_each(
pin_list,
- [=, this, &list, &t](
- LBAMappingRef &pin) -> Cache::get_extent_iertr::future<>
+ [this, FNAME, type, paddr_seg_id, &extent_list, &t](
+ LBAMappingRef& pin) -> Cache::get_extent_iertr::future<>
{
+ DEBUGT("got pin, try read in parallel ... -- {}", t, *pin);
auto pin_paddr = pin->get_val();
+ if (pin_paddr.get_addr_type() != paddr_types_t::SEGMENT) {
+ return seastar::now();
+ }
auto &pin_seg_paddr = pin_paddr.as_seg_paddr();
auto pin_paddr_seg_id = pin_seg_paddr.get_segment_id();
// auto pin_len = pin->get_length();
@@ -779,16 +784,16 @@ TransactionManager::get_extents_if_live(
// ceph_assert(pin_seg_paddr >= paddr &&
// pin_seg_paddr.add_offset(pin_len) <= paddr.add_offset(len));
return read_pin_by_type(t, std::move(pin), type
- ).si_then([&list](auto ret) {
- list.emplace_back(std::move(ret));
+ ).si_then([&extent_list](auto ret) {
+ extent_list.emplace_back(std::move(ret));
return seastar::now();
});
- }).si_then([&list, &t, FNAME, type, laddr, len, paddr] {
+ }).si_then([&extent_list, &t, FNAME, type, laddr, len, paddr] {
DEBUGT("{} {}~0x{:x} {} is alive as {} extents",
- t, type, laddr, len, paddr, list.size());
+ t, type, laddr, len, paddr, extent_list.size());
return get_extents_if_live_ret(
interruptible::ready_future_marker{},
- std::move(list));
+ std::move(extent_list));
});
});
}).handle_error_interruptible(crimson::ct_error::enoent::handle([] {
diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h
index 5bd3c679dda..0317d3b4bb8 100644
--- a/src/crimson/os/seastore/transaction_manager.h
+++ b/src/crimson/os/seastore/transaction_manager.h
@@ -993,7 +993,11 @@ private:
// checking the lba child must be atomic with creating
// and linking the absent child
if (v.has_child()) {
- return std::move(v.get_child_fut());
+ return std::move(v.get_child_fut()
+ ).si_then([type](auto ext) {
+ ceph_assert(ext->get_type() == type);
+ return ext;
+ });
} else {
return pin_to_extent_by_type(t, std::move(pin), type);
}