From 4e2939687ac0218e649b11ab246c4498963267f1 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Tue, 25 May 2021 00:36:58 +0900 Subject: [PATCH] seastore: add abort_allocation when aborting uncommitted transaction, abort_allocation should be called to cancel in-flight allocations in in-memory allocator. Signed-off-by: Myoungwon Oh --- src/crimson/os/seastore/randomblock_manager.cc | 10 ++++++++++ src/crimson/os/seastore/randomblock_manager.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/crimson/os/seastore/randomblock_manager.cc b/src/crimson/os/seastore/randomblock_manager.cc index acd2d4d82dd43..832f567f184ad 100644 --- a/src/crimson/os/seastore/randomblock_manager.cc +++ b/src/crimson/os/seastore/randomblock_manager.cc @@ -393,6 +393,16 @@ RandomBlockManager::rbm_sync_block_bitmap_by_range(blk_id_t start, blk_id_t end, ); } +RandomBlockManager::abort_allocation_ertr::future<> +RandomBlockManager::abort_allocation(Transaction &t) +{ + /* + * TODO: clear all allocation infos associated with transaction in in-memory allocator + */ + t.clear_rbm_allocated_blocks(); + return abort_allocation_ertr::now(); +} + RandomBlockManager::write_ertr::future<> RandomBlockManager::complete_allocation(Transaction &t) { diff --git a/src/crimson/os/seastore/randomblock_manager.h b/src/crimson/os/seastore/randomblock_manager.h index 85d521a1dcc2d..41112301bff7f 100644 --- a/src/crimson/os/seastore/randomblock_manager.h +++ b/src/crimson/os/seastore/randomblock_manager.h @@ -257,6 +257,12 @@ public: */ free_block_ertr::future<> free_extent(Transaction &t, blk_paddr_t from, blk_paddr_t to); // TODO: will include trim if necessary + using abort_allocation_ertr = crimson::errorator< + crimson::ct_error::input_output_error, + crimson::ct_error::invarg + >; + abort_allocation_ertr::future<> abort_allocation(Transaction &t); + using complete_allocation_ertr = crimson::errorator< crimson::ct_error::input_output_error, crimson::ct_error::invarg, -- 2.39.5