1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H
3 #define _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H
10 } __packed __aligned(8);
12 #define BCH_ALLOC_FIELDS_V1() \
16 x(dirty_sectors, 16) \
17 x(cached_sectors, 16) \
20 x(stripe_redundancy, 8)
23 #define x(name, _bits) BCH_ALLOC_FIELD_V1_##name,
35 } __packed __aligned(8);
37 #define BCH_ALLOC_FIELDS_V2() \
40 x(dirty_sectors, 32) \
41 x(cached_sectors, 32) \
43 x(stripe_redundancy, 8)
54 } __packed __aligned(8);
56 LE32_BITMASK(BCH_ALLOC_V3_NEED_DISCARD,struct bch_alloc_v3, flags, 0, 1)
57 LE32_BITMASK(BCH_ALLOC_V3_NEED_INC_GEN,struct bch_alloc_v3, flags, 1, 2)
66 __u8 stripe_redundancy;
71 __u32 nr_external_backpointers;
72 __u64 fragmentation_lru;
73 } __packed __aligned(8);
75 #define BCH_ALLOC_V4_U64s_V0 6
76 #define BCH_ALLOC_V4_U64s (sizeof(struct bch_alloc_v4) / sizeof(__u64))
78 BITMASK(BCH_ALLOC_V4_NEED_DISCARD, struct bch_alloc_v4, flags, 0, 1)
79 BITMASK(BCH_ALLOC_V4_NEED_INC_GEN, struct bch_alloc_v4, flags, 1, 2)
80 BITMASK(BCH_ALLOC_V4_BACKPOINTERS_START,struct bch_alloc_v4, flags, 2, 8)
81 BITMASK(BCH_ALLOC_V4_NR_BACKPOINTERS, struct bch_alloc_v4, flags, 8, 14)
83 #define KEY_TYPE_BUCKET_GENS_BITS 8
84 #define KEY_TYPE_BUCKET_GENS_NR (1U << KEY_TYPE_BUCKET_GENS_BITS)
85 #define KEY_TYPE_BUCKET_GENS_MASK (KEY_TYPE_BUCKET_GENS_NR - 1)
87 struct bch_bucket_gens {
89 u8 gens[KEY_TYPE_BUCKET_GENS_NR];
90 } __packed __aligned(8);
92 #endif /* _BCACHEFS_ALLOC_BACKGROUND_FORMAT_H */