summaryrefslogtreecommitdiff
path: root/bcache.h
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-04-11 16:56:15 -0700
committerKent Overstreet <koverstreet@google.com>2013-04-11 16:56:27 -0700
commit3088f201edfe5cb0ad6117d84146c0b2b84205e8 (patch)
treee1d573cb38cfe081b47d2ad0bcba21b328aa8508 /bcache.h
parent335ac31ba59bb37bcb9e8f9a7dbb2de657135980 (diff)
Update for new superblock version for data_offset
Diffstat (limited to 'bcache.h')
-rw-r--r--bcache.h52
1 files changed, 37 insertions, 15 deletions
diff --git a/bcache.h b/bcache.h
index 2e01549..6e2a7ea 100644
--- a/bcache.h
+++ b/bcache.h
@@ -15,24 +15,27 @@ static const char bcache_magic[] = {
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 };
-/* Version 1: Backing dev
+/*
+ * Version 0: Cache device
+ * Version 1: Backing device
* Version 2: Seed pointer into btree node checksum
- * Version 3: Backing dev superblock has offset of start of data
+ * Version 3: Cache device with new UUID format
+ * Version 4: Backing device with data offset
*/
-
-#define BCACHE_SB_BDEV_VERSION 3
-#define BCACHE_SB_MAX_VERSION 3
+#define BCACHE_SB_VERSION_CDEV 0
+#define BCACHE_SB_VERSION_BDEV 1
+#define BCACHE_SB_VERSION_CDEV_WITH_UUID 3
+#define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
+#define BCACHE_SB_MAX_VERSION 4
#define SB_SECTOR 8
#define SB_LABEL_SIZE 32
-#define BDEV_DATA_START 16 /* sectors */
-
+#define BDEV_DATA_START_DEFAULT 16 /* sectors */
struct cache_sb {
uint64_t csum;
uint64_t offset; /* sector where this sb was written */
uint64_t version;
-#define CACHE_BACKING_DEV 1
uint8_t magic[16];
@@ -47,18 +50,37 @@ struct cache_sb {
uint64_t seq;
uint64_t pad[8];
- uint64_t nbuckets; /* device size */
- uint16_t block_size; /* sectors */
- uint16_t bucket_size; /* sectors */
+ union {
+ struct {
+ /* Cache devices */
+ uint64_t nbuckets; /* device size */
- uint16_t nr_in_set;
- uint16_t nr_this_dev;
+ 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;
+
+ /*
+ * block_size from the cache device section is still used by
+ * backing devices, so don't add anything here until we fix
+ * things to not need it for backing devices anymore
+ */
+ };
+ };
uint32_t last_mount; /* time_t */
uint16_t first_bucket;
- uint16_t keys; /* number of journal buckets */
- uint64_t d[]; /* journal buckets */
+ union {
+ uint16_t njournal_buckets;
+ uint16_t keys;
+ };
+ uint64_t d[]; /* journal buckets */
};
BITMASK(SB_BDEV, struct cache_sb, version, 0, 1);