aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/bset.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache/bset.h')
-rw-r--r--drivers/md/bcache/bset.h21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h
index 1d3c24f9fa0e..ba02f055bc64 100644
--- a/drivers/md/bcache/bset.h
+++ b/drivers/md/bcache/bset.h
@@ -142,6 +142,8 @@
142 * first key in that range of bytes again. 142 * first key in that range of bytes again.
143 */ 143 */
144 144
145struct cache_set;
146
145/* Btree key comparison/iteration */ 147/* Btree key comparison/iteration */
146 148
147#define MAX_BSETS 4U 149#define MAX_BSETS 4U
@@ -282,25 +284,6 @@ bool bch_extent_ptr_invalid(struct cache_set *, const struct bkey *);
282 284
283bool bch_ptr_bad(struct btree *, const struct bkey *); 285bool bch_ptr_bad(struct btree *, const struct bkey *);
284 286
285static inline uint8_t gen_after(uint8_t a, uint8_t b)
286{
287 uint8_t r = a - b;
288 return r > 128U ? 0 : r;
289}
290
291static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k,
292 unsigned i)
293{
294 return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i));
295}
296
297static inline bool ptr_available(struct cache_set *c, const struct bkey *k,
298 unsigned i)
299{
300 return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i);
301}
302
303
304typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *); 287typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *);
305 288
306struct bkey *bch_btree_iter_next(struct btree_iter *); 289struct bkey *bch_btree_iter_next(struct btree_iter *);