]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/clock_types.h
Update bcachefs sources to 2e70771b8d
[bcachefs-tools-debian] / libbcachefs / clock_types.h
1 #ifndef _BCACHE_CLOCK_TYPES_H
2 #define _BCACHE_CLOCK_TYPES_H
3
4 #include "util.h"
5
6 #define NR_IO_TIMERS            8
7
8 /*
9  * Clocks/timers in units of sectors of IO:
10  *
11  * Note - they use percpu batching, so they're only approximate.
12  */
13
14 struct io_timer;
15 typedef void (*io_timer_fn)(struct io_timer *);
16
17 struct io_timer {
18         io_timer_fn             fn;
19         unsigned long           expire;
20 };
21
22 /* Amount to buffer up on a percpu counter */
23 #define IO_CLOCK_PCPU_SECTORS   128
24
25 typedef HEAP(struct io_timer *) io_timer_heap;
26
27 struct io_clock {
28         atomic_long_t           now;
29         u16 __percpu            *pcpu_buf;
30
31         spinlock_t              timer_lock;
32         io_timer_heap           timers;
33 };
34
35 #endif /* _BCACHE_CLOCK_TYPES_H */
36