Skip to content

Commit

Permalink
crimson/os/seastore/lba_manager: clean up LBAManager::decref_extent()
Browse files Browse the repository at this point in the history
interface

Signed-off-by: Xuehan Xu <[email protected]>
  • Loading branch information
xxhdx1985126 committed May 17, 2024
1 parent a2e2443 commit 502d922
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/crimson/os/seastore/lba_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class LBAManager {
*/
virtual ref_ret decref_extent(
Transaction &t,
laddr_t addr,
bool cascade_remove) = 0;
laddr_t addr) = 0;

/**
* Increments ref count on extent
Expand Down
5 changes: 2 additions & 3 deletions src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,8 @@ class BtreeLBAManager : public LBAManager {

ref_ret decref_extent(
Transaction &t,
laddr_t addr,
bool cascade_remove) final {
return update_refcount(t, addr, -1, cascade_remove
laddr_t addr) final {
return update_refcount(t, addr, -1, true
).si_then([](auto res) {
return std::move(res.ref_update_res);
});
Expand Down
7 changes: 3 additions & 4 deletions src/crimson/os/seastore/transaction_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ TransactionManager::ref_ret TransactionManager::remove(
{
LOG_PREFIX(TransactionManager::remove);
TRACET("{}", t, *ref);
return lba_manager->decref_extent(t, ref->get_laddr(), true
return lba_manager->decref_extent(t, ref->get_laddr()
).si_then([this, FNAME, &t, ref](auto result) {
DEBUGT("extent refcount is decremented to {} -- {}",
t, result.refcount, *ref);
Expand All @@ -229,12 +229,11 @@ TransactionManager::ref_ret TransactionManager::remove(

TransactionManager::ref_ret TransactionManager::_dec_ref(
Transaction &t,
laddr_t offset,
bool cascade_remove)
laddr_t offset)
{
LOG_PREFIX(TransactionManager::_dec_ref);
TRACET("{}", t, offset);
return lba_manager->decref_extent(t, offset, cascade_remove
return lba_manager->decref_extent(t, offset
).si_then([this, FNAME, offset, &t](auto result) -> ref_ret {
DEBUGT("extent refcount is decremented to {} -- {}~{}, {}",
t, result.refcount, offset, result.length, result.addr);
Expand Down
5 changes: 2 additions & 3 deletions src/crimson/os/seastore/transaction_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class TransactionManager : public ExtentCallbackInterface {
ref_ret remove(
Transaction &t,
laddr_t offset) {
return _dec_ref(t, offset, true);
return _dec_ref(t, offset);
}

/// remove refcount for list of offset
Expand Down Expand Up @@ -803,8 +803,7 @@ class TransactionManager : public ExtentCallbackInterface {
/// Remove refcount for offset
ref_ret _dec_ref(
Transaction &t,
laddr_t offset,
bool cascade_remove);
laddr_t offset);

using update_lba_mappings_ret = LBAManager::update_mappings_ret;
update_lba_mappings_ret update_lba_mappings(
Expand Down
3 changes: 1 addition & 2 deletions src/test/crimson/seastore/test_btree_lba_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,7 @@ struct btree_lba_manager_test : btree_test_base {
[=, this](auto &t) {
return lba_manager->decref_extent(
t,
target->first,
true
target->first
).si_then([this, &t, target](auto result) {
EXPECT_EQ(result.refcount, target->second.refcount);
if (result.refcount == 0) {
Expand Down

0 comments on commit 502d922

Please sign in to comment.