xref: /linux/fs/bcachefs/replicas_format.h (revision a3a02a52bcfcbcc4a637d4b68bf1bc391c9fad02)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_REPLICAS_FORMAT_H
3 #define _BCACHEFS_REPLICAS_FORMAT_H
4 
5 struct bch_replicas_entry_v0 {
6 	__u8			data_type;
7 	__u8			nr_devs;
8 	__u8			devs[];
9 } __packed;
10 
11 struct bch_sb_field_replicas_v0 {
12 	struct bch_sb_field	field;
13 	struct bch_replicas_entry_v0 entries[];
14 } __packed __aligned(8);
15 
16 struct bch_replicas_entry_v1 {
17 	__u8			data_type;
18 	__u8			nr_devs;
19 	__u8			nr_required;
20 	__u8			devs[];
21 } __packed;
22 
23 struct bch_sb_field_replicas {
24 	struct bch_sb_field	field;
25 	struct bch_replicas_entry_v1 entries[];
26 } __packed __aligned(8);
27 
28 #define replicas_entry_bytes(_i)					\
29 	(offsetof(typeof(*(_i)), devs) + (_i)->nr_devs)
30 
31 #endif /* _BCACHEFS_REPLICAS_FORMAT_H */
32