// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
#include "bbpos.h"
#include "bkey_buf.h"
#include "btree_cache.h"
#include "btree_io.h"
#include "btree_iter.h"
#include "btree_locking.h"
#include "debug.h"
#include "errcode.h"
#include "error.h"
#include "journal.h"
#include "trace.h"
#include <linux/prefetch.h>
#include <linux/sched/mm.h>
#include <linux/swap.h>
const char * const bch2_btree_node_flags[] = {
"typebit",
"typebit",
"typebit",
#define x(f) [BTREE_NODE_##f] = #f,
BTREE_FLAGS()
#undef x
NULL
};
void bch2_recalc_btree_reserve(struct bch_fs *c)
{
unsigned reserve = 16;
if (!c->btree_roots_known[0].b)
reserve += 8;
for (unsigned i = 0; i < btree_id_nr_alive(c); i++) {
struct btree_root *r = bch2_btree_id_root(c, i);
if (r->b