]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/.../lba_manager: remove remove_mappings
authorSamuel Just <sjust@redhat.com>
Wed, 8 Oct 2025 02:23:00 +0000 (19:23 -0700)
committerSamuel Just <sjust@redhat.com>
Mon, 5 Jan 2026 21:14:58 +0000 (13:14 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/lba/btree_lba_manager.h
src/crimson/os/seastore/lba_manager.h
src/test/crimson/seastore/test_btree_lba_manager.cc

index 457fa7b62182be12949c8cbeb7b433386140f281..6cbd1bea52592d72f1868854f0e558e59559fcaa 100644 (file)
@@ -215,60 +215,6 @@ public:
     });
   }
 
-  ref_ret remove_mapping(
-    Transaction &t,
-    laddr_t addr) final {
-    auto result = co_await update_refcount(t, addr, -1);
-    ceph_assert(result.refcount == 0);
-    if (result.addr.is_paddr()) {
-      co_return ref_update_result_t{std::move(result), std::nullopt};
-    }
-
-    auto direct_result = co_await update_refcount(t, result.key, -1);
-    result.mapping = co_await result.mapping.refresh();
-    co_return ref_update_result_t{
-      std::move(result),
-      std::move(direct_result)
-    };
-  }
-
-  ref_ret remove_mapping(
-    Transaction &t,
-    LBAMapping mapping) final {
-    assert(mapping.is_viewable());
-    assert(mapping.is_complete());
-    return seastar::do_with(
-      std::move(mapping),
-      [&t, this](auto &mapping) {
-      auto &cursor = mapping.get_effective_cursor();
-      return update_refcount(t, &cursor, -1
-      ).si_then([this, &t, &mapping](auto res) {
-       ceph_assert(res.refcount == 0);
-       if (res.addr.is_paddr()) {
-         assert(!mapping.is_indirect());
-         return ref_iertr::make_ready_future<
-           ref_update_result_t>(ref_update_result_t{
-             std::move(res), std::nullopt});
-       }
-       assert(mapping.is_indirect());
-       auto &cursor = *mapping.direct_cursor;
-       return cursor.refresh().si_then([this, &t, &cursor] {
-         return update_refcount(t, &cursor, -1);
-       }).si_then([indirect_result=std::move(res)]
-                  (auto direct_result) mutable {
-         return indirect_result.mapping.refresh(
-         ).si_then([direct_result=std::move(direct_result),
-                    indirect_result=std::move(indirect_result)](auto) {
-           return ref_iertr::make_ready_future<
-             ref_update_result_t>(ref_update_result_t{
-               std::move(indirect_result),
-               std::move(direct_result)});
-         });
-       });
-      });
-    });
-  }
-
   base_iertr::future<LBACursorRef> update_mapping_refcount(
     Transaction &t,
     LBACursorRef cursor,
index 19545016a308213954ca95231ce210d4fe95dfa3..62c1aa5186e61fd1ac581f72bb94aa154bc8f84e 100644 (file)
@@ -175,35 +175,8 @@ public:
       return refcount == 0 && addr.is_paddr() && !addr.get_paddr().is_zero();
     }
   };
-  struct ref_update_result_t {
-    mapping_update_result_t result;
-    std::optional<mapping_update_result_t> direct_result;
-  };
   using ref_iertr = base_iertr::extend<
     crimson::ct_error::enoent>;
-  using ref_ret = ref_iertr::future<ref_update_result_t>;
-
-  /**
-   * Removes a mapping and deal with indirection
-   *
-   * @return returns the information about the removed
-   * mappings including the corresponding direct mapping
-   * if the mapping of laddr is indirect.
-   */
-  virtual ref_ret remove_mapping(
-    Transaction &t,
-    laddr_t addr) = 0;
-
-  /*
-   * Removes the mapping and deal with indirection
-   *
-   * @return returns the information about the removed
-   * mappings including the corresponding direct mapping
-   * if the mapping of laddr is indirect.
-   */
-  virtual ref_ret remove_mapping(
-    Transaction &t,
-    LBAMapping mapping) = 0;
 
   /**
    * Update ref count on mapping
index 53b3d74bd067dec996b611b7b294465591898151..be870746b526117dd59f510eda36ee8968cc9c18 100644 (file)
@@ -597,19 +597,24 @@ struct btree_lba_manager_test : btree_test_base {
 
     (void) with_trans_intr(
       *t.t,
-      [=, this](auto &t) {
-       return lba_manager->remove_mapping(
+      seastar::coroutine::lambda([=, this](auto &t)
+                                -> LBAManager::ref_iertr::future<> {
+
+       auto cursor = co_await lba_manager->get_cursor(
          t,
-         target->first
-       ).si_then([this, &t, target](auto result) {
-         EXPECT_EQ(result.result.refcount, target->second.refcount);
-         if (result.result.refcount == 0) {
-           return cache->retire_extent_addr(
-             t, result.result.addr.get_paddr(), result.result.length);
-         }
-         return Cache::retire_extent_iertr::now();
-       });
-      }).unsafe_get();
+         target->first);
+       auto refcount = cursor->get_refcount() - 1;
+       co_await lba_manager->update_mapping_refcount(
+         t,
+         cursor,
+         -1
+       );
+       EXPECT_EQ(refcount, target->second.refcount);
+       if (refcount == 0) {
+         co_await cache->retire_extent_addr(
+           t, cursor->get_paddr(), cursor->get_length());
+       }
+      })).unsafe_get();
     if (target->second.refcount == 0) {
       t.mappings.erase(target);
     }