xref: /linux/fs/bcachefs/reflink_format.h (revision e91c37f1)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_REFLINK_FORMAT_H
3 #define _BCACHEFS_REFLINK_FORMAT_H
4 
5 struct bch_reflink_p {
6 	struct bch_val		v;
7 	__le64			idx;
8 	/*
9 	 * A reflink pointer might point to an indirect extent which is then
10 	 * later split (by copygc or rebalance). If we only pointed to part of
11 	 * the original indirect extent, and then one of the fragments is
12 	 * outside the range we point to, we'd leak a refcount: so when creating
13 	 * reflink pointers, we need to store pad values to remember the full
14 	 * range we were taking a reference on.
15 	 */
16 	__le32			front_pad;
17 	__le32			back_pad;
18 } __packed __aligned(8);
19 
20 struct bch_reflink_v {
21 	struct bch_val		v;
22 	__le64			refcount;
23 	union bch_extent_entry	start[0];
24 	__u64			_data[];
25 } __packed __aligned(8);
26 
27 struct bch_indirect_inline_data {
28 	struct bch_val		v;
29 	__le64			refcount;
30 	u8			data[];
31 };
32 
33 #endif /* _BCACHEFS_REFLINK_FORMAT_H */
34