]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/clock_types.h
Rename from bcache-tools to bcachefs-tools
[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 struct io_clock {
26         atomic_long_t           now;
27         u16 __percpu            *pcpu_buf;
28
29         spinlock_t              timer_lock;
30         DECLARE_HEAP(struct io_timer *, timers);
31 };
32
33 #endif /* _BCACHE_CLOCK_TYPES_H */
34