diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-19 15:33:38 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-09-09 09:41:49 -0400 |
| commit | fdbc9c390ade238383f5a24e4b32e49550dc90e4 (patch) | |
| tree | a6a9d97fa3fc8826cde5ed5611b3e1ea7ba06e4f /fs/bcachefs/time_stats.c | |
| parent | bcachefs: Drop memalloc_nofs_save() in bch2_btree_node_mem_alloc() (diff) | |
| download | linux-fdbc9c390ade238383f5a24e4b32e49550dc90e4.tar.gz linux-fdbc9c390ade238383f5a24e4b32e49550dc90e4.zip | |
bcachefs: bch2_time_stats_reset()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/time_stats.c')
| -rw-r--r-- | fs/bcachefs/time_stats.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/bcachefs/time_stats.c b/fs/bcachefs/time_stats.c index 4508e9dcbee2..3fe82757f93a 100644 --- a/fs/bcachefs/time_stats.c +++ b/fs/bcachefs/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); |
