1 #ifndef _BCACHEFS_ALLOC_TYPES_H
2 #define _BCACHEFS_ALLOC_TYPES_H
4 #include <linux/mutex.h>
5 #include <linux/spinlock.h>
7 #include "clock_types.h"
10 /* There's two of these clocks, one for reads and one for writes: */
13 * "now" in (read/write) IO time - incremented whenever we do X amount
16 * Goes with the bucket read/write prios: when we read or write to a
17 * bucket we reset the bucket's prio to the current hand; thus hand -
18 * prio = time since bucket was last read/written.
20 * The units are some amount (bytes/sectors) of data read/written, and
21 * the units can change on the fly if we need to rescale to fit
22 * everything in a u16 - your only guarantee is that the units are
30 struct io_timer rescale;
34 /* There is one reserve for each type of btree, one for prios and gens
35 * and one for moving GC */
44 typedef FIFO(long) alloc_fifo;
46 /* Enough for 16 cache devices, 2 tiers and some left over for pipelining */
47 #define OPEN_BUCKETS_COUNT 256
48 #define WRITE_POINT_COUNT 32
56 unsigned sectors_free;
57 struct bch_extent_ptr ptr;
61 struct hlist_node node;
64 unsigned long write_point;
65 enum bch_data_type type;
70 /* calculated based on how many pointers we're actually going to use: */
71 unsigned sectors_free;
73 struct open_bucket *ptrs[BCH_REPLICAS_MAX * 2];
74 u64 next_alloc[BCH_SB_MEMBERS_MAX];
77 struct write_point_specifier {
81 struct alloc_heap_entry {
87 typedef HEAP(struct alloc_heap_entry) alloc_heap;
89 #endif /* _BCACHEFS_ALLOC_TYPES_H */