1
0
mirror of https://github.com/ceph/ceph synced 2025-04-01 23:02:17 +00:00

crimson/os/seastore: enable CBJournal trim during transaction_manager unit test

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
This commit is contained in:
myoungwon oh 2022-06-17 15:14:41 +09:00 committed by Yingxin Cheng
parent c2b9e770f7
commit 0d941855ff
5 changed files with 11 additions and 34 deletions

View File

@ -649,10 +649,8 @@ void AsyncCleaner::update_journal_tails(
journal_seq_t alloc_tail)
{
LOG_PREFIX(AsyncCleaner::update_journal_tails);
if (disable_trim) return;
if (dirty_tail != JOURNAL_SEQ_NULL) {
assert(dirty_tail.offset.get_addr_type() != paddr_types_t::RANDOM_BLOCK);
ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
journal_head >= dirty_tail);
if (journal_dirty_tail != JOURNAL_SEQ_NULL &&
@ -672,7 +670,6 @@ void AsyncCleaner::update_journal_tails(
if (alloc_tail != JOURNAL_SEQ_NULL) {
ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
journal_head >= alloc_tail);
assert(alloc_tail.offset.get_addr_type() != paddr_types_t::RANDOM_BLOCK);
if (journal_alloc_tail != JOURNAL_SEQ_NULL &&
journal_alloc_tail > alloc_tail) {
ERROR("journal_alloc_tail {} => {} is backwards!",
@ -1202,9 +1199,6 @@ void AsyncCleaner::start_gc()
LOG_PREFIX(AsyncCleaner::start_gc);
ceph_assert(state == cleaner_state_t::SCAN_SPACE);
state = cleaner_state_t::READY;
if (disable_trim) {
return;
}
INFO("done, start GC, {}", gc_stat_printer_t{this, true});
ceph_assert(journal_head != JOURNAL_SEQ_NULL);
ceph_assert(journal_alloc_tail != JOURNAL_SEQ_NULL);
@ -1376,8 +1370,7 @@ segment_id_t AsyncCleaner::get_next_reclaim_segment() const
void AsyncCleaner::log_gc_state(const char *caller) const
{
LOG_PREFIX(AsyncCleaner::log_gc_state);
if (LOCAL_LOGGER.is_enabled(seastar::log_level::debug) &&
!disable_trim) {
if (LOCAL_LOGGER.is_enabled(seastar::log_level::debug)) {
DEBUG("caller {}, {}", caller, gc_stat_printer_t{this, true});
}
}
@ -1385,9 +1378,6 @@ void AsyncCleaner::log_gc_state(const char *caller) const
seastar::future<>
AsyncCleaner::reserve_projected_usage(std::size_t projected_usage)
{
if (disable_trim) {
return seastar::now();
}
ceph_assert(is_ready());
// The pipeline configuration prevents another IO from entering
// prepare until the prior one exits and clears this.
@ -1430,7 +1420,6 @@ AsyncCleaner::reserve_projected_usage(std::size_t projected_usage)
void AsyncCleaner::release_projected_usage(std::size_t projected_usage)
{
if (disable_trim) return;
ceph_assert(is_ready());
ceph_assert(stats.projected_used_bytes >= projected_usage);
stats.projected_used_bytes -= projected_usage;

View File

@ -826,15 +826,6 @@ private:
SegmentSeqAllocatorRef ool_segment_seq_allocator;
/**
* disable_trim
*
* added to enable unit testing of CircularBoundedJournal before
* proper support is added to AsyncCleaner.
* Should be removed once proper support is added. TODO
*/
bool disable_trim = false;
public:
AsyncCleaner(
config_t config,
@ -971,10 +962,6 @@ public:
bool check_usage();
void set_disable_trim(bool val) {
disable_trim = val;
}
using work_ertr = ExtentCallbackInterface::extent_mapping_ertr;
using work_iertr = ExtentCallbackInterface::extent_mapping_iertr;
@ -1211,6 +1198,9 @@ private:
* Segments calculations
*/
std::size_t get_segments_in_journal() const {
if (journal_type == journal_type_t::CIRCULAR) {
return 0;
}
auto journal_tail = get_journal_tail();
if (journal_tail == JOURNAL_SEQ_NULL ||
journal_head == JOURNAL_SEQ_NULL) {
@ -1313,13 +1303,11 @@ private:
*/
bool should_block_on_trim() const {
assert(is_ready());
if (disable_trim) return false;
return get_tail_limit() > get_journal_tail();
}
bool should_block_on_reclaim() const {
assert(is_ready());
if (disable_trim) return false;
if (get_segments_reclaimable() == 0) {
return false;
}
@ -1357,7 +1345,6 @@ private:
*/
bool gc_should_reclaim_space() const {
assert(is_ready());
if (disable_trim) return false;
if (get_segments_reclaimable() == 0) {
return false;
}
@ -1385,7 +1372,6 @@ private:
* True if gc should be running.
*/
bool gc_should_run() const {
if (disable_trim) return false;
ceph_assert(is_ready());
return gc_should_reclaim_space()
|| gc_should_trim_dirty()

View File

@ -123,7 +123,9 @@ BtreeBackrefManager::new_mapping(
{
ceph_assert(
is_aligned(
key.as_seg_paddr().get_segment_off(),
key.get_addr_type() == paddr_types_t::SEGMENT ?
key.as_seg_paddr().get_segment_off() :
key.as_blk_paddr().get_block_off(),
(uint64_t)cache.get_block_size()));
struct state_t {
paddr_t last_end;

View File

@ -378,6 +378,10 @@ Journal::replay_ret CircularBoundedJournal::replay(
});
});
});
}).safe_then([this]() {
trimmer.update_journal_tails(
header.dirty_tail,
header.alloc_tail);
});
});
}

View File

@ -624,7 +624,6 @@ TransactionManagerRef make_transaction_manager(
const std::vector<Device*> &secondary_devices,
bool is_test)
{
LOG_PREFIX(make_transaction_manager);
auto epm = std::make_unique<ExtentPlacementManager>();
auto cache = std::make_unique<Cache>(*epm);
auto lba_manager = lba_manager::create_lba_manager(*cache);
@ -693,9 +692,6 @@ TransactionManagerRef make_transaction_manager(
*async_cleaner,
static_cast<random_block_device::RBMDevice*>(primary_device),
"");
async_cleaner->set_disable_trim(true);
ERROR("disabling journal trimming since support for CircularBoundedJournal "
"hasn't been added yet");
}
epm->set_async_cleaner(std::move(async_cleaner));