From bd58665f335b8b893a6c2d219ec91a5ae045dc8b Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Wed, 12 Jan 2022 13:35:47 +0800 Subject: [PATCH] crimson/os/seastore/journal: fast submit if RecordSubmitter is IDLE and no pending Signed-off-by: Yingxin Cheng --- src/crimson/os/seastore/journal.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/crimson/os/seastore/journal.cc b/src/crimson/os/seastore/journal.cc index 33257b99f3d9..c1fc6e5d8916 100644 --- a/src/crimson/os/seastore/journal.cc +++ b/src/crimson/os/seastore/journal.cc @@ -685,8 +685,9 @@ Journal::RecordSubmitter::submit_pending( assert(!p_current_batch->is_submitting()); stats.record_batch_stats.increment( p_current_batch->get_num_records() + 1); - auto write_fut = [this, flush, record=std::move(record)]() mutable { - if (flush && p_current_batch->is_empty()) { + bool do_flush = (flush || state == state_t::IDLE); + auto write_fut = [this, do_flush, record=std::move(record)]() mutable { + if (do_flush && p_current_batch->is_empty()) { // fast path with direct write increment_io(); auto [to_write, sizes] = p_current_batch->submit_pending_fast( @@ -708,7 +709,7 @@ Journal::RecordSubmitter::submit_pending( // indirect write with or without the existing pending records auto write_fut = p_current_batch->add_pending( std::move(record), journal_segment_manager.get_block_size()); - if (flush || state == state_t::IDLE) { + if (do_flush) { flush_current_batch(); } return write_fut; -- 2.47.3