summaryrefslogtreecommitdiff
path: root/fs/bcachefs/ec_types.h
blob: 809446c789518b18d0752dbe9d654f87f2acc4ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_EC_TYPES_H
#define _BCACHEFS_EC_TYPES_H

#include "bcachefs_format.h"

union bch_replicas_padded {
	u8				bytes[struct_size_t(struct bch_replicas_entry_v1,
							    devs, BCH_BKEY_PTRS_MAX)];
	struct bch_replicas_entry_v1	e;
};

struct stripe {
	size_t			heap_idx;
	u16			sectors;
	u8			algorithm;
	u8			nr_blocks;
	u8			nr_redundant;
	u8			blocks_nonempty;
	u8			disk_label;
};

struct gc_stripe {
	u8			lock;
	unsigned		alive:1; /* does a corresponding key exist in stripes btree? */
	u16			sectors;
	u8			nr_blocks;
	u8			nr_redundant;
	u16			block_sectors[BCH_BKEY_PTRS_MAX];
	struct bch_extent_ptr	ptrs[BCH_BKEY_PTRS_MAX];

	union bch_replicas_padded r;
};

#endif /* _BCACHEFS_EC_TYPES_H */