summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-01 21:01:02 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-08 15:33:11 -0500
commitf1582f4774ac7c30c5460a8c7a6e5a82b9ce5a6a (patch)
tree557c47260c4ff951791f0f324514b3f33ff17c48
parent82bca17dd526ee0304141a7fd978811cda9e92b4 (diff)
bcachefs: time_stats: Check for last_event == 0 when updating freq statsbcachefs-for-v6.7-stable-20240208
This fixes spurious outliers in the frequency stats. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index 84b142fcc3df..3b7c349f2665 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -362,14 +362,15 @@ static inline void bch2_time_stats_update_one(struct bch2_time_stats *stats,
bch2_quantiles_update(&stats->quantiles, duration);
}
- if (time_after64(end, stats->last_event)) {
+ if (stats->last_event && time_after64(end, stats->last_event)) {
freq = end - stats->last_event;
mean_and_variance_update(&stats->freq_stats, freq);
mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq);
stats->max_freq = max(stats->max_freq, freq);
stats->min_freq = min(stats->min_freq, freq);
- stats->last_event = end;
}
+
+ stats->last_event = end;
}
static noinline void bch2_time_stats_clear_buffer(struct bch2_time_stats *stats,