From: Thomas Weißschuh Date: Sat, 3 Jun 2023 11:13:37 +0000 (+0200) Subject: libblkid: (bcache) extend superblock definition X-Git-Tag: v2.40-rc1~405^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2f4b5c83b7376941e35b064200b8bf3d66ca499;p=thirdparty%2Futil-linux.git libblkid: (bcache) extend superblock definition We will need it for the correct checksum calculation. Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index c8ac52425e..dd80b2c934 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -17,10 +17,11 @@ #include "xxhash.h" #define SB_LABEL_SIZE 32 +#define SB_JOURNAL_BUCKETS 256U /* - * The bcache_super_block is heavily simplified version of struct cache_sb in kernel. - * https://github.com/torvalds/linux/blob/master/include/uapi/linux/bcache.h + * The bcache_super_block is adapted from struct cache_sb in kernel. + * https://github.com/torvalds/linux/blob/master/drivers/md/bcache/bcache_ondisk.h */ struct bcache_super_block { uint64_t csum; @@ -28,6 +29,43 @@ struct bcache_super_block { uint64_t version; uint8_t magic[16]; /* bcache file system identifier */ uint8_t uuid[16]; /* device identifier */ + uint8_t set_info[16]; /* magic or uuid */ + uint8_t label[SB_LABEL_SIZE]; + uint64_t flags; + uint64_t seq; + + uint64_t feature_compat; + uint64_t feature_incompat; + uint64_t feature_ro_compat; + + uint64_t pad[5]; + + union { + struct { + /* Cache devices */ + uint64_t nbuckets; /* device size */ + + uint16_t block_size; /* sectors */ + uint16_t bucket_size; /* sectors */ + + uint16_t nr_in_set; + uint16_t nr_this_dev; + }; + struct { + /* Backing devices */ + uint64_t data_offset; + }; + }; + + uint32_t last_mount; + + uint16_t first_bucket; + union { + uint16_t njournal_buckets; + uint16_t keys; + }; + uint64_t d[SB_JOURNAL_BUCKETS]; /* journal buckets */ + uint16_t obso_bucket_size_hi; /* obsoleted */ } __attribute__((packed)); struct bcachefs_sb_field {