Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
fork
Configure Feed
Select the types of activity you want to include in your feed.
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_INODE_FORMAT_H
3#define _BCACHEFS_INODE_FORMAT_H
4
5#define BLOCKDEV_INODE_MAX 4096
6#define BCACHEFS_ROOT_INO 4096
7
8struct bch_inode {
9 struct bch_val v;
10
11 __le64 bi_hash_seed;
12 __le32 bi_flags;
13 __le16 bi_mode;
14 __u8 fields[];
15} __packed __aligned(8);
16
17struct bch_inode_v2 {
18 struct bch_val v;
19
20 __le64 bi_journal_seq;
21 __le64 bi_hash_seed;
22 __le64 bi_flags;
23 __le16 bi_mode;
24 __u8 fields[];
25} __packed __aligned(8);
26
27struct bch_inode_v3 {
28 struct bch_val v;
29
30 __le64 bi_journal_seq;
31 __le64 bi_hash_seed;
32 __le64 bi_flags;
33 __le64 bi_sectors;
34 __le64 bi_size;
35 __le64 bi_version;
36 __u8 fields[];
37} __packed __aligned(8);
38
39#define INODEv3_FIELDS_START_INITIAL 6
40#define INODEv3_FIELDS_START_CUR (offsetof(struct bch_inode_v3, fields) / sizeof(__u64))
41
42struct bch_inode_generation {
43 struct bch_val v;
44
45 __le32 bi_generation;
46 __le32 pad;
47} __packed __aligned(8);
48
49/*
50 * bi_subvol and bi_parent_subvol are only set for subvolume roots:
51 */
52
53#define BCH_INODE_FIELDS_v2() \
54 x(bi_atime, 96) \
55 x(bi_ctime, 96) \
56 x(bi_mtime, 96) \
57 x(bi_otime, 96) \
58 x(bi_size, 64) \
59 x(bi_sectors, 64) \
60 x(bi_uid, 32) \
61 x(bi_gid, 32) \
62 x(bi_nlink, 32) \
63 x(bi_generation, 32) \
64 x(bi_dev, 32) \
65 x(bi_data_checksum, 8) \
66 x(bi_compression, 8) \
67 x(bi_project, 32) \
68 x(bi_background_compression, 8) \
69 x(bi_data_replicas, 8) \
70 x(bi_promote_target, 16) \
71 x(bi_foreground_target, 16) \
72 x(bi_background_target, 16) \
73 x(bi_erasure_code, 16) \
74 x(bi_fields_set, 16) \
75 x(bi_dir, 64) \
76 x(bi_dir_offset, 64) \
77 x(bi_subvol, 32) \
78 x(bi_parent_subvol, 32)
79
80#define BCH_INODE_FIELDS_v3() \
81 x(bi_atime, 96) \
82 x(bi_ctime, 96) \
83 x(bi_mtime, 96) \
84 x(bi_otime, 96) \
85 x(bi_uid, 32) \
86 x(bi_gid, 32) \
87 x(bi_nlink, 32) \
88 x(bi_generation, 32) \
89 x(bi_dev, 32) \
90 x(bi_data_checksum, 8) \
91 x(bi_compression, 8) \
92 x(bi_project, 32) \
93 x(bi_background_compression, 8) \
94 x(bi_data_replicas, 8) \
95 x(bi_promote_target, 16) \
96 x(bi_foreground_target, 16) \
97 x(bi_background_target, 16) \
98 x(bi_erasure_code, 16) \
99 x(bi_fields_set, 16) \
100 x(bi_dir, 64) \
101 x(bi_dir_offset, 64) \
102 x(bi_subvol, 32) \
103 x(bi_parent_subvol, 32) \
104 x(bi_nocow, 8) \
105 x(bi_depth, 32) \
106 x(bi_inodes_32bit, 8) \
107 x(bi_casefold, 8)
108
109/* subset of BCH_INODE_FIELDS */
110#define BCH_INODE_OPTS() \
111 x(data_checksum, 8) \
112 x(compression, 8) \
113 x(project, 32) \
114 x(background_compression, 8) \
115 x(data_replicas, 8) \
116 x(promote_target, 16) \
117 x(foreground_target, 16) \
118 x(background_target, 16) \
119 x(erasure_code, 16) \
120 x(nocow, 8) \
121 x(inodes_32bit, 8) \
122 x(casefold, 8)
123
124enum inode_opt_id {
125#define x(name, ...) \
126 Inode_opt_##name,
127 BCH_INODE_OPTS()
128#undef x
129 Inode_opt_nr,
130};
131
132/*
133 * BCH_INODE_has_case_insensitive is set if any descendent is case insensitive -
134 * for overlayfs
135 */
136#define BCH_INODE_FLAGS() \
137 x(sync, 0) \
138 x(immutable, 1) \
139 x(append, 2) \
140 x(nodump, 3) \
141 x(noatime, 4) \
142 x(i_size_dirty, 5) \
143 x(i_sectors_dirty, 6) \
144 x(unlinked, 7) \
145 x(backptr_untrusted, 8) \
146 x(has_child_snapshot, 9) \
147 x(has_case_insensitive, 10)
148
149/* bits 20+ reserved for packed fields below: */
150
151enum bch_inode_flags {
152#define x(t, n) BCH_INODE_##t = 1U << n,
153 BCH_INODE_FLAGS()
154#undef x
155};
156
157enum __bch_inode_flags {
158#define x(t, n) __BCH_INODE_##t = n,
159 BCH_INODE_FLAGS()
160#undef x
161};
162
163LE32_BITMASK(INODEv1_STR_HASH, struct bch_inode, bi_flags, 20, 24);
164LE32_BITMASK(INODEv1_NR_FIELDS, struct bch_inode, bi_flags, 24, 31);
165LE32_BITMASK(INODEv1_NEW_VARINT,struct bch_inode, bi_flags, 31, 32);
166
167LE64_BITMASK(INODEv2_STR_HASH, struct bch_inode_v2, bi_flags, 20, 24);
168LE64_BITMASK(INODEv2_NR_FIELDS, struct bch_inode_v2, bi_flags, 24, 31);
169
170LE64_BITMASK(INODEv3_STR_HASH, struct bch_inode_v3, bi_flags, 20, 24);
171LE64_BITMASK(INODEv3_NR_FIELDS, struct bch_inode_v3, bi_flags, 24, 31);
172
173LE64_BITMASK(INODEv3_FIELDS_START,
174 struct bch_inode_v3, bi_flags, 31, 36);
175LE64_BITMASK(INODEv3_MODE, struct bch_inode_v3, bi_flags, 36, 52);
176
177struct bch_inode_alloc_cursor {
178 struct bch_val v;
179 __u8 bits;
180 __u8 pad;
181 __le32 gen;
182 __le64 idx;
183};
184
185#endif /* _BCACHEFS_INODE_FORMAT_H */