2010-10-08 18:04:49 +04:00
|
|
|
#ifndef _BCACHE_H
|
|
|
|
#define _BCACHE_H
|
|
|
|
|
|
|
|
static const char bcache_magic[] = {
|
|
|
|
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
|
|
|
|
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 };
|
|
|
|
|
2011-05-20 07:25:14 +04:00
|
|
|
struct bkey {
|
|
|
|
uint64_t header;
|
|
|
|
uint64_t key;
|
|
|
|
uint64_t ptr[];
|
|
|
|
};
|
|
|
|
|
2010-10-08 18:04:49 +04:00
|
|
|
struct cache_sb {
|
|
|
|
uint8_t magic[16];
|
2011-05-20 07:25:14 +04:00
|
|
|
uint8_t uuid[16];
|
|
|
|
uint8_t set_uuid[16];
|
|
|
|
uint64_t sequence;
|
|
|
|
|
2010-12-16 12:22:45 +03:00
|
|
|
#define CACHE_CLEAN 1
|
|
|
|
#define CACHE_SYNC 2
|
2011-05-20 07:25:14 +04:00
|
|
|
#define CACHE_BACKING_DEV 4
|
2010-10-08 18:04:49 +04:00
|
|
|
uint32_t version;
|
|
|
|
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 */
|
2011-05-20 07:25:14 +04:00
|
|
|
|
|
|
|
union {
|
|
|
|
struct bkey btree_root;
|
|
|
|
uint64_t _pad[8];
|
|
|
|
};
|
2010-10-08 18:04:49 +04:00
|
|
|
uint16_t btree_level;
|
2011-04-16 00:22:09 +04:00
|
|
|
uint16_t nr_in_set;
|
|
|
|
uint16_t nr_this_dev;
|
|
|
|
uint16_t _pad[1];
|
2011-05-25 01:12:00 +04:00
|
|
|
#define SB_LABEL_SIZE 32
|
|
|
|
uint8_t label[SB_LABEL_SIZE];
|
2010-10-08 18:04:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bucket_disk {
|
|
|
|
uint16_t priority;
|
|
|
|
uint8_t generation;
|
|
|
|
} __attribute((packed));
|
|
|
|
|
|
|
|
#endif
|