#ifndef _BCACHE_UTIL_H
#define _BCACHE_UTIL_H
#include <linux/blkdev.h>
#include <linux/closure.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched/clock.h>
#include <linux/llist.h>
#include <linux/min_heap.h>
#include <linux/ratelimit.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/crc64.h>
struct closure;
#ifdef CONFIG_BCACHE_DEBUG
#define EBUG_ON(cond) …
#define atomic_dec_bug(v) …
#define atomic_inc_bug(v, i) …
#else
#define EBUG_ON …
#define atomic_dec_bug …
#define atomic_inc_bug …
#endif
#define init_heap(heap, _size, gfp) …
#define free_heap(heap) …
#define DECLARE_FIFO(type, name) …
#define fifo_for_each(c, fifo, iter) …
#define __init_fifo(fifo, gfp) …
#define init_fifo_exact(fifo, _size, gfp) …
#define init_fifo(fifo, _size, gfp) …
#define free_fifo(fifo) …
#define fifo_used(fifo) …
#define fifo_free(fifo) …
#define fifo_empty(fifo) …
#define fifo_full(fifo) …
#define fifo_front(fifo) …
#define fifo_back(fifo) …
#define fifo_idx(fifo, p) …
#define fifo_push_back(fifo, i) …
#define fifo_pop_front(fifo, i) …
#define fifo_push_front(fifo, i) …
#define fifo_pop_back(fifo, i) …
#define fifo_push(fifo, i) …
#define fifo_pop(fifo, i) …
#define fifo_swap(l, r) …
#define fifo_move(dest, src) …
#define DECLARE_ARRAY_ALLOCATOR(type, name, size) …
#define array_alloc(array) …
#define array_free(array, ptr) …
#define array_allocator_init(array) …
#define array_freelist_empty(array) …
#define ANYSINT_MAX(t) …
int bch_strtoint_h(const char *cp, int *res);
int bch_strtouint_h(const char *cp, unsigned int *res);
int bch_strtoll_h(const char *cp, long long *res);
int bch_strtoull_h(const char *cp, unsigned long long *res);
static inline int bch_strtol_h(const char *cp, long *res)
{ … }
static inline int bch_strtoul_h(const char *cp, long *res)
{ … }
#define strtoi_h(cp, res) …
#define strtoul_safe(cp, var) …
#define strtoul_safe_clamp(cp, var, min, max) …
ssize_t bch_hprint(char *buf, int64_t v);
bool bch_is_zero(const char *p, size_t n);
int bch_parse_uuid(const char *s, char *uuid);
struct time_stats { … };
void bch_time_stats_update(struct time_stats *stats, uint64_t time);
static inline unsigned int local_clock_us(void)
{ … }
#define NSEC_PER_ns …
#define NSEC_PER_us …
#define NSEC_PER_ms …
#define NSEC_PER_sec …
#define __print_time_stat(stats, name, stat, units) …
#define sysfs_print_time_stats(stats, name, \
frequency_units, \
duration_units) …
#define sysfs_time_stats_attribute(name, \
frequency_units, \
duration_units) …
#define sysfs_time_stats_attribute_list(name, \
frequency_units, \
duration_units) …
#define ewma_add(ewma, val, weight, factor) …
struct bch_ratelimit { … };
static inline void bch_ratelimit_reset(struct bch_ratelimit *d)
{ … }
uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done);
#define __DIV_SAFE(n, d, zero) …
#define DIV_SAFE(n, d) …
#define container_of_or_null(ptr, type, member) …
#define RB_INSERT(root, new, member, cmp) …
#define RB_SEARCH(root, search, member, cmp) …
#define RB_GREATER(root, search, member, cmp) …
#define RB_FIRST(root, type, member) …
#define RB_LAST(root, type, member) …
#define RB_NEXT(ptr, member) …
#define RB_PREV(ptr, member) …
static inline uint64_t bch_crc64(const void *p, size_t len)
{ … }
static inline unsigned int fract_exp_two(unsigned int x,
unsigned int fract_bits)
{ … }
void bch_bio_map(struct bio *bio, void *base);
int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask);
#endif