Loading drivers/md/bcache/bcache.h +18 −5 Original line number Original line Diff line number Diff line Loading @@ -704,11 +704,6 @@ struct bbio { struct bio bio; struct bio bio; }; }; static inline unsigned local_clock_us(void) { return local_clock() >> 10; } #define BTREE_PRIO USHRT_MAX #define BTREE_PRIO USHRT_MAX #define INITIAL_PRIO 32768 #define INITIAL_PRIO 32768 Loading Loading @@ -776,6 +771,24 @@ static inline struct bucket *PTR_BUCKET(struct cache_set *c, return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); } } static inline uint8_t gen_after(uint8_t a, uint8_t b) { uint8_t r = a - b; return r > 128U ? 0 : r; } static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k, unsigned i) { return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i)); } static inline bool ptr_available(struct cache_set *c, const struct bkey *k, unsigned i) { return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i); } /* Btree key macros */ /* Btree key macros */ static inline void bkey_init(struct bkey *k) static inline void bkey_init(struct bkey *k) Loading drivers/md/bcache/bset.h +2 −19 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,8 @@ * first key in that range of bytes again. * first key in that range of bytes again. */ */ struct cache_set; /* Btree key comparison/iteration */ /* Btree key comparison/iteration */ #define MAX_BSETS 4U #define MAX_BSETS 4U Loading Loading @@ -282,25 +284,6 @@ bool bch_extent_ptr_invalid(struct cache_set *, const struct bkey *); bool bch_ptr_bad(struct btree *, const struct bkey *); bool bch_ptr_bad(struct btree *, const struct bkey *); static inline uint8_t gen_after(uint8_t a, uint8_t b) { uint8_t r = a - b; return r > 128U ? 0 : r; } static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k, unsigned i) { return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i)); } static inline bool ptr_available(struct cache_set *c, const struct bkey *k, unsigned i) { return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i); } typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *); typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *); struct bkey *bch_btree_iter_next(struct btree_iter *); struct bkey *bch_btree_iter_next(struct btree_iter *); Loading drivers/md/bcache/util.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ #ifndef _BCACHE_UTIL_H #ifndef _BCACHE_UTIL_H #define _BCACHE_UTIL_H #define _BCACHE_UTIL_H #include <linux/blkdev.h> #include <linux/errno.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/kernel.h> #include <linux/llist.h> #include <linux/llist.h> Loading Loading @@ -391,6 +392,11 @@ struct time_stats { void bch_time_stats_update(struct time_stats *stats, uint64_t time); void bch_time_stats_update(struct time_stats *stats, uint64_t time); static inline unsigned local_clock_us(void) { return local_clock() >> 10; } #define NSEC_PER_ns 1L #define NSEC_PER_ns 1L #define NSEC_PER_us NSEC_PER_USEC #define NSEC_PER_us NSEC_PER_USEC #define NSEC_PER_ms NSEC_PER_MSEC #define NSEC_PER_ms NSEC_PER_MSEC Loading Loading
drivers/md/bcache/bcache.h +18 −5 Original line number Original line Diff line number Diff line Loading @@ -704,11 +704,6 @@ struct bbio { struct bio bio; struct bio bio; }; }; static inline unsigned local_clock_us(void) { return local_clock() >> 10; } #define BTREE_PRIO USHRT_MAX #define BTREE_PRIO USHRT_MAX #define INITIAL_PRIO 32768 #define INITIAL_PRIO 32768 Loading Loading @@ -776,6 +771,24 @@ static inline struct bucket *PTR_BUCKET(struct cache_set *c, return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); return PTR_CACHE(c, k, ptr)->buckets + PTR_BUCKET_NR(c, k, ptr); } } static inline uint8_t gen_after(uint8_t a, uint8_t b) { uint8_t r = a - b; return r > 128U ? 0 : r; } static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k, unsigned i) { return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i)); } static inline bool ptr_available(struct cache_set *c, const struct bkey *k, unsigned i) { return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i); } /* Btree key macros */ /* Btree key macros */ static inline void bkey_init(struct bkey *k) static inline void bkey_init(struct bkey *k) Loading
drivers/md/bcache/bset.h +2 −19 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,8 @@ * first key in that range of bytes again. * first key in that range of bytes again. */ */ struct cache_set; /* Btree key comparison/iteration */ /* Btree key comparison/iteration */ #define MAX_BSETS 4U #define MAX_BSETS 4U Loading Loading @@ -282,25 +284,6 @@ bool bch_extent_ptr_invalid(struct cache_set *, const struct bkey *); bool bch_ptr_bad(struct btree *, const struct bkey *); bool bch_ptr_bad(struct btree *, const struct bkey *); static inline uint8_t gen_after(uint8_t a, uint8_t b) { uint8_t r = a - b; return r > 128U ? 0 : r; } static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k, unsigned i) { return gen_after(PTR_BUCKET(c, k, i)->gen, PTR_GEN(k, i)); } static inline bool ptr_available(struct cache_set *c, const struct bkey *k, unsigned i) { return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && PTR_CACHE(c, k, i); } typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *); typedef bool (*ptr_filter_fn)(struct btree *, const struct bkey *); struct bkey *bch_btree_iter_next(struct btree_iter *); struct bkey *bch_btree_iter_next(struct btree_iter *); Loading
drivers/md/bcache/util.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -2,6 +2,7 @@ #ifndef _BCACHE_UTIL_H #ifndef _BCACHE_UTIL_H #define _BCACHE_UTIL_H #define _BCACHE_UTIL_H #include <linux/blkdev.h> #include <linux/errno.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/kernel.h> #include <linux/llist.h> #include <linux/llist.h> Loading Loading @@ -391,6 +392,11 @@ struct time_stats { void bch_time_stats_update(struct time_stats *stats, uint64_t time); void bch_time_stats_update(struct time_stats *stats, uint64_t time); static inline unsigned local_clock_us(void) { return local_clock() >> 10; } #define NSEC_PER_ns 1L #define NSEC_PER_ns 1L #define NSEC_PER_us NSEC_PER_USEC #define NSEC_PER_us NSEC_PER_USEC #define NSEC_PER_ms NSEC_PER_MSEC #define NSEC_PER_ms NSEC_PER_MSEC Loading