xref: /linux/fs/bcachefs/lru_format.h (revision 4a4b30ea80d8cb5e8c4c62bb86201f4ea0d9b030)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_LRU_FORMAT_H
3 #define _BCACHEFS_LRU_FORMAT_H
4 
5 struct bch_lru {
6 	struct bch_val		v;
7 	__le64			idx;
8 } __packed __aligned(8);
9 
10 #define BCH_LRU_TYPES()		\
11 	x(read)			\
12 	x(fragmentation)	\
13 	x(stripes)
14 
15 enum bch_lru_type {
16 #define x(n) BCH_LRU_##n,
17 	BCH_LRU_TYPES()
18 #undef x
19 };
20 
21 #define BCH_LRU_BUCKET_FRAGMENTATION	((1U << 16) - 1)
22 #define BCH_LRU_STRIPE_FRAGMENTATION	((1U << 16) - 2)
23 
24 #define LRU_TIME_BITS			48
25 #define LRU_TIME_MAX			((1ULL << LRU_TIME_BITS) - 1)
26 
27 #endif /* _BCACHEFS_LRU_FORMAT_H */
28