diff options
author | Kent Overstreet <koverstreet@google.com> | 2011-07-25 00:18:42 -0700 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2011-07-25 00:18:42 -0700 |
commit | c798b43aded89d8161d924316bd5a80c4956b009 (patch) | |
tree | 6e7088f2c9f593212f81ad501b34c757f48012be /bcache.h | |
parent | d1404a0cf1be18f2635dd52627ab75ca71c84ca9 (diff) |
New superblock format
Diffstat (limited to 'bcache.h')
-rw-r--r-- | bcache.h | 52 |
1 files changed, 32 insertions, 20 deletions
@@ -5,38 +5,50 @@ static const char bcache_magic[] = { 0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca, 0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 }; -struct bkey { - uint64_t header; - uint64_t key; - uint64_t ptr[]; -}; +#define SB_LABEL_SIZE 32 struct cache_sb { + uint64_t csum; + uint64_t offset_this_sb; + uint64_t version; +#define CACHE_BACKING_DEV 1 + uint8_t magic[16]; + uint8_t uuid[16]; uint8_t set_uuid[16]; + uint8_t label[SB_LABEL_SIZE]; + +#define CACHE_SYNC (1U << 0) + +#define BDEV_WRITEBACK_BIT 0U + +#define BDEV_STATE_NONE 0U +#define BDEV_STATE_CLEAN 1U +#define BDEV_STATE_DIRTY 2U +#define BDEV_STATE_STALE 3U + uint64_t flags; uint64_t sequence; + uint64_t pad[8]; -#define CACHE_CLEAN 1 -#define CACHE_SYNC 2 -#define CACHE_BACKING_DEV 4 - uint32_t version; + uint64_t nbuckets; /* device size */ uint16_t block_size; /* sectors */ uint16_t bucket_size; /* sectors */ - uint32_t journal_start; /* buckets */ - uint32_t first_bucket; /* start of data */ - uint64_t nbuckets; /* device size */ - union { - struct bkey btree_root; - uint64_t _pad[8]; - }; - uint16_t btree_level; uint16_t nr_in_set; uint16_t nr_this_dev; - uint16_t _pad[1]; -#define SB_LABEL_SIZE 32 - uint8_t label[SB_LABEL_SIZE]; + + uint32_t last_mount; /* time_t */ + + uint16_t first_bucket; + uint16_t njournal_buckets; + uint64_t journal_buckets[]; +}; + +struct bkey { + uint64_t header; + uint64_t key; + uint64_t ptr[]; }; struct bucket_disk { |