1 #ifndef _BCACHE_ALLOC_TYPES_H
2 #define _BCACHE_ALLOC_TYPES_H
4 #include <linux/mutex.h>
6 #include "clock_types.h"
9 * There's two of these clocks, one for reads and one for writes:
11 * All fields protected by bucket_lock
15 * "now" in (read/write) IO time - incremented whenever we do X amount
18 * Goes with the bucket read/write prios: when we read or write to a
19 * bucket we reset the bucket's prio to the current hand; thus hand -
20 * prio = time since bucket was last read/written.
22 * The units are some amount (bytes/sectors) of data read/written, and
23 * the units can change on the fly if we need to rescale to fit
24 * everything in a u16 - your only guarantee is that the units are
32 struct io_timer rescale;
35 /* There is one reserve for each type of btree, one for prios and gens
36 * and one for moving GC */
52 } d[BCH_SB_MEMBERS_MAX];
55 /* Enough for 16 cache devices, 2 tiers and some left over for pipelining */
56 #define OPEN_BUCKETS_COUNT 256
58 #define WRITE_POINT_COUNT 16
61 struct list_head list;
66 * recalculated every time we allocate from this open_bucket based on
67 * how many pointers we're actually going to use:
69 unsigned sectors_free;
71 struct bch_extent_ptr ptrs[BCH_REPLICAS_MAX];
72 unsigned ptr_offset[BCH_REPLICAS_MAX];
76 struct open_bucket *b;
79 * Throttle writes to this write point if tier 0 is full?
84 * If not NULL, cache group for tiering, promotion and moving GC -
85 * always allocates a single replica
87 struct dev_group *group;
90 * Otherwise do a normal replicated bucket allocation that could come
91 * from any device in tier 0 (foreground write)
95 struct alloc_heap_entry {
100 typedef HEAP(struct alloc_heap_entry) alloc_heap;
102 #endif /* _BCACHE_ALLOC_TYPES_H */