]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/transaction_manager: add get_extent_if_linked() interface
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 9 May 2024 11:59:19 +0000 (19:59 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 13 Jun 2024 12:25:49 +0000 (15:25 +0300)
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit a6f90bc27ec62c6595028aa97524abffd682dcf3)

src/crimson/os/seastore/transaction_manager.h

index 862bd9fa12f9747bcdd9f2e244f1953c37ca4e32..917295d37f13e99f09448bbc6793abdd7a30da94 100644 (file)
@@ -175,6 +175,20 @@ public:
   base_iertr::future<TCachedExtentRef<T>> read_pin(
     Transaction &t,
     LBAMappingRef pin)
+  {
+    auto ret = get_extent_if_linked<T>(t, std::move(pin));
+    if (ret.index() == 1) {
+      return std::move(std::get<1>(ret));
+    } else {
+      return this->pin_to_extent<T>(t, std::move(std::get<0>(ret)));
+    }
+  }
+
+  template <typename T>
+  std::variant<LBAMappingRef, base_iertr::future<TCachedExtentRef<T>>>
+  get_extent_if_linked(
+    Transaction &t,
+    LBAMappingRef pin)
   {
     auto v = pin->get_logical_extent(t);
     if (v.has_child()) {
@@ -190,7 +204,7 @@ public:
        return extent->template cast<T>();
       });
     } else {
-      return pin_to_extent<T>(t, std::move(pin));
+      return pin;
     }
   }