#include "bcachefs.h"
#include "btree_key_cache.h"
#include "btree_update.h"
#include "btree_write_buffer.h"
#include "buckets.h"
#include "errcode.h"
#include "error.h"
#include "journal.h"
#include "journal_io.h"
#include "journal_reclaim.h"
#include "replicas.h"
#include "sb-members.h"
#include "trace.h"
#include <linux/kthread.h>
#include <linux/sched/mm.h>
static unsigned journal_space_from(struct journal_device *ja,
enum journal_space_from from)
{ … }
unsigned bch2_journal_dev_buckets_available(struct journal *j,
struct journal_device *ja,
enum journal_space_from from)
{ … }
void bch2_journal_set_watermark(struct journal *j)
{ … }
static struct journal_space
journal_dev_space_available(struct journal *j, struct bch_dev *ca,
enum journal_space_from from)
{ … }
static struct journal_space __journal_space_available(struct journal *j, unsigned nr_devs_want,
enum journal_space_from from)
{ … }
void bch2_journal_space_available(struct journal *j)
{ … }
static bool should_discard_bucket(struct journal *j, struct journal_device *ja)
{ … }
void bch2_journal_do_discards(struct journal *j)
{ … }
void bch2_journal_reclaim_fast(struct journal *j)
{ … }
bool __bch2_journal_pin_put(struct journal *j, u64 seq)
{ … }
void bch2_journal_pin_put(struct journal *j, u64 seq)
{ … }
static inline bool __journal_pin_drop(struct journal *j,
struct journal_entry_pin *pin)
{ … }
void bch2_journal_pin_drop(struct journal *j,
struct journal_entry_pin *pin)
{ … }
static enum journal_pin_type journal_pin_type(journal_pin_flush_fn fn)
{ … }
static inline void bch2_journal_pin_set_locked(struct journal *j, u64 seq,
struct journal_entry_pin *pin,
journal_pin_flush_fn flush_fn,
enum journal_pin_type type)
{ … }
void bch2_journal_pin_copy(struct journal *j,
struct journal_entry_pin *dst,
struct journal_entry_pin *src,
journal_pin_flush_fn flush_fn)
{ … }
void bch2_journal_pin_set(struct journal *j, u64 seq,
struct journal_entry_pin *pin,
journal_pin_flush_fn flush_fn)
{ … }
void bch2_journal_pin_flush(struct journal *j, struct journal_entry_pin *pin)
{ … }
static struct journal_entry_pin *
journal_get_next_pin(struct journal *j,
u64 seq_to_flush,
unsigned allowed_below_seq,
unsigned allowed_above_seq,
u64 *seq)
{ … }
static size_t journal_flush_pins(struct journal *j,
u64 seq_to_flush,
unsigned allowed_below_seq,
unsigned allowed_above_seq,
unsigned min_any,
unsigned min_key_cache)
{ … }
static u64 journal_seq_to_flush(struct journal *j)
{ … }
static int __bch2_journal_reclaim(struct journal *j, bool direct, bool kicked)
{ … }
int bch2_journal_reclaim(struct journal *j)
{ … }
static int bch2_journal_reclaim_thread(void *arg)
{ … }
void bch2_journal_reclaim_stop(struct journal *j)
{ … }
int bch2_journal_reclaim_start(struct journal *j)
{ … }
static int journal_flush_done(struct journal *j, u64 seq_to_flush,
bool *did_work)
{ … }
bool bch2_journal_flush_pins(struct journal *j, u64 seq_to_flush)
{ … }
int bch2_journal_flush_device_pins(struct journal *j, int dev_idx)
{ … }