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 &&
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!",
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);
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});
}
}
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.
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;
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,
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;
* 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) {
*/
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;
}
*/
bool gc_should_reclaim_space() const {
assert(is_ready());
- if (disable_trim) return false;
if (get_segments_reclaimable() == 0) {
return false;
}
* 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()
{
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;
});
});
});
+ }).safe_then([this]() {
+ trimmer.update_journal_tails(
+ header.dirty_tail,
+ header.alloc_tail);
});
});
}
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);
*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));