int64_t writeback_rate_proportional;
int64_t writeback_rate_integral;
int64_t writeback_rate_integral_scaled;
- int64_t writeback_rate_change;
+ int32_t writeback_rate_change;
unsigned writeback_rate_update_seconds;
unsigned writeback_rate_i_term_inverse;
uint64_t next;
/*
- * Rate at which we want to do work, in units per nanosecond
+ * Rate at which we want to do work, in units per second
* The units here correspond to the units passed to bch_next_delay()
*/
- unsigned rate;
+ uint32_t rate;
};
static inline void bch_ratelimit_reset(struct bch_ratelimit *d)
int64_t error = dirty - target;
int64_t proportional_scaled =
div_s64(error, dc->writeback_rate_p_term_inverse);
- int64_t integral_scaled, new_rate;
+ int64_t integral_scaled;
+ uint32_t new_rate;
if ((error < 0 && dc->writeback_rate_integral > 0) ||
(error > 0 && time_before64(local_clock(),
integral_scaled = div_s64(dc->writeback_rate_integral,
dc->writeback_rate_i_term_inverse);
- new_rate = clamp_t(int64_t, (proportional_scaled + integral_scaled),
- dc->writeback_rate_minimum, NSEC_PER_MSEC);
+ new_rate = clamp_t(int32_t, (proportional_scaled + integral_scaled),
+ dc->writeback_rate_minimum, NSEC_PER_SEC);
dc->writeback_rate_proportional = proportional_scaled;
dc->writeback_rate_integral_scaled = integral_scaled;