aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/journal.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache/journal.h')
-rw-r--r--drivers/md/bcache/journal.h52
1 files changed, 7 insertions, 45 deletions
diff --git a/drivers/md/bcache/journal.h b/drivers/md/bcache/journal.h
index 3d7851274b04..a6472fda94b2 100644
--- a/drivers/md/bcache/journal.h
+++ b/drivers/md/bcache/journal.h
@@ -75,43 +75,6 @@
75 * nodes that are pinning the oldest journal entries first. 75 * nodes that are pinning the oldest journal entries first.
76 */ 76 */
77 77
78#define BCACHE_JSET_VERSION_UUIDv1 1
79/* Always latest UUID format */
80#define BCACHE_JSET_VERSION_UUID 1
81#define BCACHE_JSET_VERSION 1
82
83/*
84 * On disk format for a journal entry:
85 * seq is monotonically increasing; every journal entry has its own unique
86 * sequence number.
87 *
88 * last_seq is the oldest journal entry that still has keys the btree hasn't
89 * flushed to disk yet.
90 *
91 * version is for on disk format changes.
92 */
93struct jset {
94 uint64_t csum;
95 uint64_t magic;
96 uint64_t seq;
97 uint32_t version;
98 uint32_t keys;
99
100 uint64_t last_seq;
101
102 BKEY_PADDED(uuid_bucket);
103 BKEY_PADDED(btree_root);
104 uint16_t btree_level;
105 uint16_t pad[3];
106
107 uint64_t prio_bucket[MAX_CACHES_PER_SET];
108
109 union {
110 struct bkey start[0];
111 uint64_t d[0];
112 };
113};
114
115/* 78/*
116 * Only used for holding the journal entries we read in btree_journal_read() 79 * Only used for holding the journal entries we read in btree_journal_read()
117 * during cache_registration 80 * during cache_registration
@@ -140,7 +103,8 @@ struct journal {
140 spinlock_t lock; 103 spinlock_t lock;
141 /* used when waiting because the journal was full */ 104 /* used when waiting because the journal was full */
142 struct closure_waitlist wait; 105 struct closure_waitlist wait;
143 struct closure_with_timer io; 106 struct closure io;
107 struct delayed_work work;
144 108
145 /* Number of blocks free in the bucket(s) we're currently writing to */ 109 /* Number of blocks free in the bucket(s) we're currently writing to */
146 unsigned blocks_free; 110 unsigned blocks_free;
@@ -188,8 +152,7 @@ struct journal_device {
188}; 152};
189 153
190#define journal_pin_cmp(c, l, r) \ 154#define journal_pin_cmp(c, l, r) \
191 (fifo_idx(&(c)->journal.pin, (l)->journal) > \ 155 (fifo_idx(&(c)->journal.pin, (l)) > fifo_idx(&(c)->journal.pin, (r)))
192 fifo_idx(&(c)->journal.pin, (r)->journal))
193 156
194#define JOURNAL_PIN 20000 157#define JOURNAL_PIN 20000
195 158
@@ -199,15 +162,14 @@ struct journal_device {
199struct closure; 162struct closure;
200struct cache_set; 163struct cache_set;
201struct btree_op; 164struct btree_op;
165struct keylist;
202 166
203void bch_journal(struct closure *); 167atomic_t *bch_journal(struct cache_set *, struct keylist *, struct closure *);
204void bch_journal_next(struct journal *); 168void bch_journal_next(struct journal *);
205void bch_journal_mark(struct cache_set *, struct list_head *); 169void bch_journal_mark(struct cache_set *, struct list_head *);
206void bch_journal_meta(struct cache_set *, struct closure *); 170void bch_journal_meta(struct cache_set *, struct closure *);
207int bch_journal_read(struct cache_set *, struct list_head *, 171int bch_journal_read(struct cache_set *, struct list_head *);
208 struct btree_op *); 172int bch_journal_replay(struct cache_set *, struct list_head *);
209int bch_journal_replay(struct cache_set *, struct list_head *,
210 struct btree_op *);
211 173
212void bch_journal_free(struct cache_set *); 174void bch_journal_free(struct cache_set *);
213int bch_journal_alloc(struct cache_set *); 175int bch_journal_alloc(struct cache_set *);