if (cold_cleaner) {
cold_cleaner->maybe_adjust_thresholds();
}
- if (unlikely(test_workload && force_process_state != ForceProcessState::STOP)) {
- last_process_state = force_process_state;
- force_process_state = ForceProcessState::STOP;
- set_next_arm_timepoint();
- }
+ maybe_reschedule_force_process();
} else {
log_state("run(block)");
assert(!blocking_background);
if (unlikely(test_workload)) {
- set_next_arm_timepoint();
+ set_next_force_process();
}
blocking_background = seastar::promise<>();
co_await blocking_background->get_future();
bool force_trim = false;
bool should_abort_cleaner_usage = true;
- if (unlikely(test_workload && force_process_state == ForceProcessState::TRIM)) {
+ if (unlikely(should_force_trim())) {
if (!proceed_trim) {
should_abort_cleaner_usage = false;
}
eviction_state.is_fast_mode(), logical_bucket->should_demote());
bool abort_cold_cleaner_usage = true;
- if (unlikely(test_workload && force_process_state == ForceProcessState::CLEAN)) {
+ if (unlikely(should_force_clean())) {
if (!proceed_clean_main) {
abort_cold_cleaner_usage = false;
}
"seastore_test_workload_write_through_probability");
SUBINFO(seastore_epm, "crimson test workload supported, enabled: {}", test_workload);
if (test_workload) {
- set_next_arm_timepoint();
+ set_next_force_process();
}
}
seastar::timer<seastar::steady_clock_type> force_background_timer;
int force_process_half_life;
- void set_next_arm_timepoint() {
+ void set_next_force_process() {
assert(test_workload);
force_background_timer.rearm(
seastar::steady_clock_type::now() +
do_wake_background();
}
+ void maybe_reschedule_force_process() {
+ if (unlikely(test_workload &&
+ force_process_state != ForceProcessState::STOP)) {
+ last_process_state = force_process_state;
+ force_process_state = ForceProcessState::STOP;
+ set_next_force_process();
+ }
+ }
+
+ bool should_force_trim() const {
+ return test_workload && force_process_state == ForceProcessState::TRIM;
+ }
+
+ bool should_force_clean() const {
+ return test_workload && force_process_state == ForceProcessState::CLEAN;
+ }
+
bool force_run_background() const {
return test_workload && force_process_state != ForceProcessState::STOP
&& (logical_bucket && logical_bucket->could_demote());