xref: /linux/fs/bcachefs/ec_format.h (revision 2622f290417001b0440f4a48dc6978f5f1e12a56)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_EC_FORMAT_H
3 #define _BCACHEFS_EC_FORMAT_H
4 
5 struct bch_stripe {
6 	struct bch_val		v;
7 	__le16			sectors;
8 	__u8			algorithm;
9 	__u8			nr_blocks;
10 	__u8			nr_redundant;
11 
12 	__u8			csum_granularity_bits;
13 	__u8			csum_type;
14 
15 	/*
16 	 * XXX: targets should be 16 bits - fix this if we ever do a stripe_v2
17 	 *
18 	 * we can manage with this because this only needs to point to a
19 	 * disk label, not a target:
20 	 */
21 	__u8			disk_label;
22 
23 	/*
24 	 * Variable length sections:
25 	 * - Pointers
26 	 * - Checksums
27 	 *   2D array of [stripe block/device][csum block], with checksum block
28 	 *   size given by csum_granularity_bits
29 	 * - Block sector counts: per-block array of u16s
30 	 *
31 	 * XXX:
32 	 * Either checksums should have come last, or we should have included a
33 	 * checksum_size field (the size in bytes of the checksum itself, not
34 	 * the blocksize the checksum covers).
35 	 *
36 	 * Currently we aren't able to access the block sector counts if the
37 	 * checksum type is unknown.
38 	 */
39 
40 	struct bch_extent_ptr	ptrs[];
41 } __packed __aligned(8);
42 
43 #endif /* _BCACHEFS_EC_FORMAT_H */
44