summaryrefslogtreecommitdiff
path: root/libbcachefs/time_stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/time_stats.c')
-rw-r--r--libbcachefs/time_stats.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libbcachefs/time_stats.c b/libbcachefs/time_stats.c
index 2c34fe4b..7b5fa448 100644
--- a/libbcachefs/time_stats.c
+++ b/libbcachefs/time_stats.c
@@ -138,10 +138,8 @@ void __bch2_time_stats_update(struct bch2_time_stats *stats, u64 start, u64 end)
GFP_ATOMIC);
spin_unlock_irqrestore(&stats->lock, flags);
} else {
- struct time_stat_buffer *b;
-
- preempt_disable();
- b = this_cpu_ptr(stats->buffer);
+ guard(preempt)();
+ struct time_stat_buffer *b = this_cpu_ptr(stats->buffer);
BUG_ON(b->nr >= ARRAY_SIZE(b->entries));
b->entries[b->nr++] = (struct time_stat_buffer_entry) {
@@ -151,7 +149,6 @@ void __bch2_time_stats_update(struct bch2_time_stats *stats, u64 start, u64 end)
if (unlikely(b->nr == ARRAY_SIZE(b->entries)))
time_stats_clear_buffer(stats, b);
- preempt_enable();
}
}