summaryrefslogtreecommitdiff
path: root/libbcachefs/time_stats.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-08-23 15:38:12 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-08-23 19:34:30 -0400
commitb422b19f636329e1a082bcacd3ac6b485d7a5b3e (patch)
treeee9979640d17b982ed92581557634a6df57b2fc8 /libbcachefs/time_stats.c
parent6f938e0399ce04699682459408b090387c73adb3 (diff)
Update bcachefs sources to 22fa8fc32e6a bcachefs: rcu_pending now works in userspace
Diffstat (limited to 'libbcachefs/time_stats.c')
-rw-r--r--libbcachefs/time_stats.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libbcachefs/time_stats.c b/libbcachefs/time_stats.c
index 4508e9dc..3fe82757 100644
--- a/libbcachefs/time_stats.c
+++ b/libbcachefs/time_stats.c
@@ -151,6 +151,20 @@ void __bch2_time_stats_update(struct bch2_time_stats *stats, u64 start, u64 end)
}
}
+void bch2_time_stats_reset(struct bch2_time_stats *stats)
+{
+ spin_lock_irq(&stats->lock);
+ unsigned offset = offsetof(struct bch2_time_stats, min_duration);
+ memset((void *) stats + offset, 0, sizeof(*stats) - offset);
+
+ if (stats->buffer) {
+ int cpu;
+ for_each_possible_cpu(cpu)
+ per_cpu_ptr(stats->buffer, cpu)->nr = 0;
+ }
+ spin_unlock_irq(&stats->lock);
+}
+
void bch2_time_stats_exit(struct bch2_time_stats *stats)
{
free_percpu(stats->buffer);