summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/bcache.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-05-01 07:23:05 (GMT)
committerJens Axboe <axboe@kernel.dk>2013-05-01 07:23:05 (GMT)
commitf50efd2fdbd9b35b11f5778ed85beb764184bda9 (patch)
treeed92b40995d60136fb387d210886e4aae2c37231 /drivers/md/bcache/bcache.h
parent0821e904057505c7e25d72e1a282105d023b26c9 (diff)
parentee66850642efda91d04179cae2414310675a1f73 (diff)
downloadlinux-f50efd2fdbd9b35b11f5778ed85beb764184bda9.tar.xz
Merge branch 'bcache-for-upstream' of http://evilpiepirate.org/git/linux-bcache into for-3.10/drivers
Kent writes: Hey Jens, this is everything I've got ready for 3.10 - there's _still_ one more bug I'm trying to track down. Andrew - I've got patches that rip out the pkey() and pbtree() macros, but they're somewhat tied up with some other nontrivial refactorings so I think I'm going to wait a bit on those.
Diffstat (limited to 'drivers/md/bcache/bcache.h')
-rw-r--r--drivers/md/bcache/bcache.h47
1 files changed, 37 insertions, 10 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index f057235..340146d 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -223,11 +223,17 @@ struct bkey {
#define BKEY_PADDED(key) \
union { struct bkey key; uint64_t key ## _pad[BKEY_PAD]; }
-/* Version 1: Backing device
+/* Version 0: Cache device
+ * Version 1: Backing device
* Version 2: Seed pointer into btree node checksum
- * Version 3: New UUID format
+ * Version 3: Cache device with new UUID format
+ * Version 4: Backing device with data offset
*/
-#define BCACHE_SB_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_SIZE 4096
@@ -236,13 +242,12 @@ struct bkey {
/* SB_JOURNAL_BUCKETS must be divisible by BITS_PER_LONG */
#define MAX_CACHES_PER_SET 8
-#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];
@@ -257,12 +262,28 @@ 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 block_size; /* sectors */
+ uint16_t bucket_size; /* sectors */
- uint16_t nr_in_set;
- uint16_t nr_this_dev;
+ 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 */
@@ -861,6 +882,12 @@ static inline bool key_merging_disabled(struct cache_set *c)
#endif
}
+static inline bool SB_IS_BDEV(const struct cache_sb *sb)
+{
+ return sb->version == BCACHE_SB_VERSION_BDEV
+ || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET;
+}
+
struct bbio {
unsigned submit_time_us;
union {