#include "bcache.h"
#include "btree.h"
#include "debug.h"
#include "writeback.h"
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/sched/clock.h>
#include <trace/events/bcache.h>
static void update_gc_after_writeback(struct cache_set *c)
{ … }
static uint64_t __calc_target_rate(struct cached_dev *dc)
{ … }
static void __update_writeback_rate(struct cached_dev *dc)
{ … }
static bool idle_counter_exceeded(struct cache_set *c)
{ … }
static bool set_at_max_writeback_rate(struct cache_set *c,
struct cached_dev *dc)
{ … }
static void update_writeback_rate(struct work_struct *work)
{ … }
static unsigned int writeback_delay(struct cached_dev *dc,
unsigned int sectors)
{ … }
struct dirty_io { … };
static void dirty_init(struct keybuf_key *w)
{ … }
static CLOSURE_CALLBACK(dirty_io_destructor)
{ … }
static CLOSURE_CALLBACK(write_dirty_finish)
{ … }
static void dirty_endio(struct bio *bio)
{ … }
static CLOSURE_CALLBACK(write_dirty)
{ … }
static void read_dirty_endio(struct bio *bio)
{ … }
static CLOSURE_CALLBACK(read_dirty_submit)
{ … }
static void read_dirty(struct cached_dev *dc)
{ … }
void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned int inode,
uint64_t offset, int nr_sectors)
{ … }
static bool dirty_pred(struct keybuf *buf, struct bkey *k)
{ … }
static void refill_full_stripes(struct cached_dev *dc)
{ … }
static bool refill_dirty(struct cached_dev *dc)
{ … }
static int bch_writeback_thread(void *arg)
{ … }
#define INIT_KEYS_EACH_TIME …
struct sectors_dirty_init { … };
static int sectors_dirty_init_fn(struct btree_op *_op, struct btree *b,
struct bkey *k)
{ … }
static int bch_root_node_dirty_init(struct cache_set *c,
struct bcache_device *d,
struct bkey *k)
{ … }
static int bch_dirty_init_thread(void *arg)
{ … }
static int bch_btre_dirty_init_thread_nr(void)
{ … }
void bch_sectors_dirty_init(struct bcache_device *d)
{ … }
void bch_cached_dev_writeback_init(struct cached_dev *dc)
{ … }
int bch_cached_dev_writeback_start(struct cached_dev *dc)
{ … }