Linux 6.13-rc4
[linux.git] / fs / bcachefs / clock_types.h
blob37554e4514fe7096032d72af679ef4d95d196c8e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_CLOCK_TYPES_H
3 #define _BCACHEFS_CLOCK_TYPES_H
5 #include "util.h"
7 #define NR_IO_TIMERS (BCH_SB_MEMBERS_MAX * 3)
9 /*
10 * Clocks/timers in units of sectors of IO:
12 * Note - they use percpu batching, so they're only approximate.
15 struct io_timer;
16 typedef void (*io_timer_fn)(struct io_timer *);
18 struct io_timer {
19 io_timer_fn fn;
20 void *fn2;
21 u64 expire;
24 /* Amount to buffer up on a percpu counter */
25 #define IO_CLOCK_PCPU_SECTORS 128
27 typedef DEFINE_MIN_HEAP(struct io_timer *, io_timer_heap) io_timer_heap;
29 struct io_clock {
30 atomic64_t now;
31 u16 __percpu *pcpu_buf;
32 unsigned max_slop;
34 spinlock_t timer_lock;
35 io_timer_heap timers;
38 #endif /* _BCACHEFS_CLOCK_TYPES_H */