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 */
40 RESERVE_METADATA_LAST = RESERVE_BTREE,
47 static inline bool allocation_is_metadata(enum alloc_reserve id)
49 return id <= RESERVE_METADATA_LAST;
59 } d[MAX_CACHES_PER_SET];
62 /* Enough for 16 cache devices, 2 tiers and some left over for pipelining */
63 #define OPEN_BUCKETS_COUNT 256
65 #define WRITE_POINT_COUNT 16
68 struct list_head list;
73 * recalculated every time we allocate from this open_bucket based on
74 * how many pointers we're actually going to use:
76 unsigned sectors_free;
78 struct bch_extent_ptr ptrs[BCH_REPLICAS_MAX];
79 unsigned ptr_offset[BCH_REPLICAS_MAX];
83 struct open_bucket *b;
86 * Throttle writes to this write point if tier 0 is full?
91 * If not NULL, cache group for tiering, promotion and moving GC -
92 * always allocates a single replica
94 struct cache_group *group;
97 * Otherwise do a normal replicated bucket allocation that could come
98 * from any device in tier 0 (foreground write)
102 #endif /* _BCACHE_ALLOC_TYPES_H */