History

bcache: use a separate data structure for the on-disk super block

Split out an on-disk version struct cache_sb with the proper endianness annotations. This fixes a fair chunk of sparse warnings, but there are some left due to the way the checksum is defined.

Christoph Hellwig committed 6 years ago

Commit a702a691 parent e8547d42 files · +54 −3Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bcache.h+51−0
@@ -156,6 +156,57 @@ static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) · 155 unmodified lines
156156
157157 #define BDEV_DATA_START_DEFAULT 16 /* sectors */
158158
159+struct cache_sb_disk {
160+ __le64 csum;
161+ __le64 offset; /* sector where this sb was written */
162+ __le64 version;
163+
164+ __u8 magic[16];
165+
166+ __u8 uuid[16];
167+ union {
168+ __u8 set_uuid[16];
169+ __le64 set_magic;
170+ };
171+ __u8 label[SB_LABEL_SIZE];
172+
173+ __le64 flags;
174+ __le64 seq;
175+ __le64 pad[8];
176+
177+ union {
178+ struct {
179+ /* Cache devices */
180+ __le64 nbuckets; /* device size */
181+
182+ __le16 block_size; /* sectors */
183+ __le16 bucket_size; /* sectors */
184+
185+ __le16 nr_in_set;
186+ __le16 nr_this_dev;
187+ };
188+ struct {
189+ /* Backing devices */
190+ __le64 data_offset;
191+
192+ /*
193+ * block_size from the cache device section is still used by
194+ * backing devices, so don't add anything here until we fix
195+ * things to not need it for backing devices anymore
196+ */
197+ };
198+ };
199+
200+ __le32 last_mount; /* time overflow in y2106 */
201+
202+ __le16 first_bucket;
203+ union {
204+ __le16 njournal_buckets;
205+ __le16 keys;
206+ };
207+ __le64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */
208+};
209+
159210 struct cache_sb {
160211 __u64 csum;
161212 __u64 offset; /* sector where this sb was written */