summaryrefslogtreecommitdiff
path: root/bcache.h
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2011-07-25 10:46:20 -0700
committerKent Overstreet <koverstreet@google.com>2011-07-25 11:28:05 -0700
commit02614b5c8154f1b2f76235202142db7abd8cff91 (patch)
tree9860a0fc0e5f19af7ed3aaccb6d121dfe3c7ee4e /bcache.h
parentc798b43aded89d8161d924316bd5a80c4956b009 (diff)
Give make-bcache the ability to format multiple devices at once
Diffstat (limited to 'bcache.h')
-rw-r--r--bcache.h63
1 files changed, 24 insertions, 39 deletions
diff --git a/bcache.h b/bcache.h
index 5cf08bc..eab2195 100644
--- a/bcache.h
+++ b/bcache.h
@@ -5,55 +5,40 @@ static const char bcache_magic[] = {
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 };
-#define SB_LABEL_SIZE 32
+#define SB_SECTOR 8
+#define SB_LABEL_SIZE 32
struct cache_sb {
- uint64_t csum;
- uint64_t offset_this_sb;
- uint64_t version;
+ uint64_t csum;
+ uint64_t offset; /* sector where this sb was written */
+ uint64_t version;
#define CACHE_BACKING_DEV 1
- uint8_t magic[16];
+ uint8_t magic[16];
- uint8_t uuid[16];
- uint8_t set_uuid[16];
- uint8_t label[SB_LABEL_SIZE];
+ uint8_t uuid[16];
+ union {
+ uint8_t set_uuid[16];
+ uint64_t set_magic;
+ };
+ uint8_t label[SB_LABEL_SIZE];
-#define CACHE_SYNC (1U << 0)
+ uint64_t flags;
+ uint64_t seq;
+ uint64_t pad[8];
-#define BDEV_WRITEBACK_BIT 0U
+ uint64_t nbuckets; /* device size */
+ uint16_t block_size; /* sectors */
+ uint16_t bucket_size; /* sectors */
-#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];
+ uint16_t nr_in_set;
+ uint16_t nr_this_dev;
- uint64_t nbuckets; /* device size */
- uint16_t block_size; /* sectors */
- uint16_t bucket_size; /* sectors */
+ uint32_t last_mount; /* time_t */
- uint16_t nr_in_set;
- uint16_t nr_this_dev;
-
- uint32_t last_mount; /* time_t */
-
- uint16_t first_bucket;
- uint16_t njournal_buckets;
- uint64_t journal_buckets[];
+ uint16_t first_bucket;
+ uint16_t keys; /* number of journal buckets */
+ uint64_t d[512]; /* journal buckets */
};
-struct bkey {
- uint64_t header;
- uint64_t key;
- uint64_t ptr[];
-};
-
-struct bucket_disk {
- uint16_t priority;
- uint8_t generation;
-} __attribute((packed));
-
#endif