We have struct cache_sb_disk for on-disk super block already, it is unnecessary to keep the in-memory super block format exactly mapping to the on-disk struct layout. This patch adds code comments to notice that struct cache_sb is not exactly mapping to cache_sb_disk, and removes the useless member csum and pad[5]. Although struct cache_sb does not belong to uapi, but there are still some on-disk format related macros reference it and it is unncessary to get rid of such dependency now. So struct cache_sb will continue to stay in include/uapi/linux/bache.h for now.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -215,8 +215,13 @@ struct cache_sb_disk { · 214 unmodified lines | |||
| 215 | __le64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */ | 215 | __le64 d[SB_JOURNAL_BUCKETS]; /* journal buckets */ |
| 216 | }; | 216 | }; |
| 217 | 217 | ||
| 218 | /* | ||
| 219 | * This is for in-memory bcache super block. | ||
| 220 | * NOTE: cache_sb is NOT exactly mapping to cache_sb_disk, the member | ||
| 221 | * size, ordering and even whole struct size may be different | ||
| 222 | * from cache_sb_disk. | ||
| 223 | */ | ||
| 218 | struct cache_sb { | 224 | struct cache_sb { |
| 219 | __u64 csum; | ||
| 220 | __u64 offset; /* sector where this sb was written */ | 225 | __u64 offset; /* sector where this sb was written */ |
| 221 | __u64 version; | 226 | __u64 version; |
| 222 | 227 | ||
| @@ -236,8 +241,6 @@ struct cache_sb { · 13 unmodified lines | |||
| 236 | __u64 feature_incompat; | 241 | __u64 feature_incompat; |
| 237 | __u64 feature_ro_compat; | 242 | __u64 feature_ro_compat; |
| 238 | 243 | ||
| 239 | __u64 pad[5]; | ||
| 240 | |||
| 241 | union { | 244 | union { |
| 242 | struct { | 245 | struct { |
| 243 | /* Cache devices */ | 246 | /* Cache devices */ |
| @@ -245,7 +248,6 @@ struct cache_sb { · 1 unmodified line | |||
| 245 | 248 | ||
| 246 | __u16 block_size; /* sectors */ | 249 | __u16 block_size; /* sectors */ |
| 247 | __u16 bucket_size; /* sectors */ | 250 | __u16 bucket_size; /* sectors */ |
| 248 | |||
| 249 | __u16 nr_in_set; | 251 | __u16 nr_in_set; |
| 250 | __u16 nr_this_dev; | 252 | __u16 nr_this_dev; |
| 251 | }; | 253 | }; |