#include "bcachefs.h"
#include "alloc_background.h"
#include "alloc_foreground.h"
#include "btree_iter.h"
#include "btree_update.h"
#include "btree_write_buffer.h"
#include "buckets.h"
#include "clock.h"
#include "compress.h"
#include "disk_groups.h"
#include "errcode.h"
#include "error.h"
#include "inode.h"
#include "move.h"
#include "rebalance.h"
#include "subvolume.h"
#include "super-io.h"
#include "trace.h"
#include <linux/freezer.h>
#include <linux/kthread.h>
#include <linux/sched/cputime.h>
#define REBALANCE_WORK_SCAN_OFFSET …
static const char * const bch2_rebalance_state_strs[] = …;
static int __bch2_set_rebalance_needs_scan(struct btree_trans *trans, u64 inum)
{ … }
int bch2_set_rebalance_needs_scan(struct bch_fs *c, u64 inum)
{ … }
int bch2_set_fs_needs_rebalance(struct bch_fs *c)
{ … }
static int bch2_clear_rebalance_needs_scan(struct btree_trans *trans, u64 inum, u64 cookie)
{ … }
static struct bkey_s_c next_rebalance_entry(struct btree_trans *trans,
struct btree_iter *work_iter)
{ … }
static int bch2_bkey_clear_needs_rebalance(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k)
{ … }
static struct bkey_s_c next_rebalance_extent(struct btree_trans *trans,
struct bpos work_pos,
struct btree_iter *extent_iter,
struct data_update_opts *data_opts)
{ … }
noinline_for_stack
static int do_rebalance_extent(struct moving_context *ctxt,
struct bpos work_pos,
struct btree_iter *extent_iter)
{ … }
static bool rebalance_pred(struct bch_fs *c, void *arg,
struct bkey_s_c k,
struct bch_io_opts *io_opts,
struct data_update_opts *data_opts)
{ … }
static int do_rebalance_scan(struct moving_context *ctxt, u64 inum, u64 cookie)
{ … }
static void rebalance_wait(struct bch_fs *c)
{ … }
static int do_rebalance(struct moving_context *ctxt)
{ … }
static int bch2_rebalance_thread(void *arg)
{ … }
void bch2_rebalance_status_to_text(struct printbuf *out, struct bch_fs *c)
{ … }
void bch2_rebalance_stop(struct bch_fs *c)
{ … }
int bch2_rebalance_start(struct bch_fs *c)
{ … }
void bch2_fs_rebalance_init(struct bch_fs *c)
{ … }