diff options
Diffstat (limited to 'drivers/md/bcache/bcache.h')
-rw-r--r-- | drivers/md/bcache/bcache.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 25f017248a81..3fd87323368c 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
@@ -704,11 +704,6 @@ struct bbio { | |||
704 | struct bio bio; | 704 | struct bio bio; |
705 | }; | 705 | }; |
706 | 706 | ||
707 | static inline unsigned local_clock_us(void) | ||
708 | { | ||
709 | return local_clock() >> 10; | ||
710 | } | ||
711 | |||
712 | #define BTREE_PRIO USHRT_MAX | 707 | #define BTREE_PRIO USHRT_MAX |
713 | #define INITIAL_PRIO 32768 | 708 | #define INITIAL_PRIO 32768 |
714 | 709 | ||
@@ -776,6 +771,24 @@ static inline struct bucket *PTR_BUCKET(struct cache_set *c, | |||
776 | return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); | 771 | return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); |
777 | } | 772 | } |
778 | 773 | ||
774 | static inline uint8_t gen_after(uint8_t a, uint8_t b) | ||
775 | { | ||
776 | uint8_t r = a - b; | ||
777 | return r > 128U ? 0 : r; | ||
778 | } | ||
779 | |||
780 | static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k, | ||
781 | unsigned i) | ||
782 | { | ||
783 | return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i)); | ||
784 | } | ||
785 | |||
786 | static inline bool ptr_available(struct cache_set *c, const struct bkey *k, | ||
787 | unsigned i) | ||
788 | { | ||
789 | return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i); | ||
790 | } | ||
791 | |||
779 | /* Btree key macros */ | 792 | /* Btree key macros */ |
780 | 793 | ||
781 | static inline void bkey_init(struct bkey *k) | 794 | static inline void bkey_init(struct bkey *k) |