linux/fs/bcachefs/super.c

// SPDX-License-Identifier: GPL-2.0
/*
 * bcachefs setup/teardown code, and some metadata io - read a superblock and
 * figure out what to do with it.
 *
 * Copyright 2010, 2011 Kent Overstreet <[email protected]>
 * Copyright 2012 Google, Inc.
 */

#include "bcachefs.h"
#include "alloc_background.h"
#include "alloc_foreground.h"
#include "bkey_sort.h"
#include "btree_cache.h"
#include "btree_gc.h"
#include "btree_journal_iter.h"
#include "btree_key_cache.h"
#include "btree_node_scan.h"
#include "btree_update_interior.h"
#include "btree_io.h"
#include "btree_write_buffer.h"
#include "buckets_waiting_for_journal.h"
#include "chardev.h"
#include "checksum.h"
#include "clock.h"
#include "compress.h"
#include "debug.h"
#include "disk_accounting.h"
#include "disk_groups.h"
#include "ec.h"
#include "errcode.h"
#include "error.h"
#include "fs.h"
#include "fs-io.h"
#include "fs-io-buffered.h"
#include "fs-io-direct.h"
#include "fsck.h"
#include "inode.h"
#include "io_read.h"
#include "io_write.h"
#include "journal.h"
#include "journal_reclaim.h"
#include "journal_seq_blacklist.h"
#include "move.h"
#include "migrate.h"
#include "movinggc.h"
#include "nocow_locking.h"
#include "quota.h"
#include "rebalance.h"
#include "recovery.h"
#include "replicas.h"
#include "sb-clean.h"
#include "sb-counters.h"
#include "sb-errors.h"
#include "sb-members.h"
#include "snapshot.h"
#include "subvolume.h"
#include "super.h"
#include "super-io.h"
#include "sysfs.h"
#include "thread_with_file.h"
#include "trace.h"

#include <linux/backing-dev.h>
#include <linux/blkdev.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/percpu.h>
#include <linux/random.h>
#include <linux/sysfs.h>
#include <crypto/hash.h>

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();

const char * const bch2_fs_flag_strs[] =;

void bch2_print_str(struct bch_fs *c, const char *str)
{}

__printf(2, 0)
static void bch2_print_maybe_redirect(struct stdio_redirect *stdio, const char *fmt, va_list args)
{}

void bch2_print_opts(struct bch_opts *opts, const char *fmt, ...)
{}

void __bch2_print(struct bch_fs *c, const char *fmt, ...)
{}

#define KTYPE(type)

static void bch2_fs_release(struct kobject *);
static void bch2_dev_release(struct kobject *);
static void bch2_fs_counters_release(struct kobject *k)
{}

static void bch2_fs_internal_release(struct kobject *k)
{}

static void bch2_fs_opts_dir_release(struct kobject *k)
{}

static void bch2_fs_time_stats_release(struct kobject *k)
{}

KTYPE();
KTYPE();
KTYPE();
KTYPE();
KTYPE();
KTYPE();

static struct kset *bcachefs_kset;
static LIST_HEAD(bch_fs_list);
static DEFINE_MUTEX(bch_fs_list_lock);

DECLARE_WAIT_QUEUE_HEAD();

static void bch2_dev_free(struct bch_dev *);
static int bch2_dev_alloc(struct bch_fs *, unsigned);
static int bch2_dev_sysfs_online(struct bch_fs *, struct bch_dev *);
static void __bch2_dev_read_only(struct bch_fs *, struct bch_dev *);

struct bch_fs *bch2_dev_to_fs(dev_t dev)
{}

static struct bch_fs *__bch2_uuid_to_fs(__uuid_t uuid)
{}

struct bch_fs *bch2_uuid_to_fs(__uuid_t uuid)
{}

/* Filesystem RO/RW: */

/*
 * For startup/shutdown of RW stuff, the dependencies are:
 *
 * - foreground writes depend on copygc and rebalance (to free up space)
 *
 * - copygc and rebalance depend on mark and sweep gc (they actually probably
 *   don't because they either reserve ahead of time or don't block if
 *   allocations fail, but allocations can require mark and sweep gc to run
 *   because of generation number wraparound)
 *
 * - all of the above depends on the allocator threads
 *
 * - allocator depends on the journal (when it rewrites prios and gens)
 */

static void __bch2_fs_read_only(struct bch_fs *c)
{}

#ifndef BCH_WRITE_REF_DEBUG
static void bch2_writes_disabled(struct percpu_ref *writes)
{
	struct bch_fs *c = container_of(writes, struct bch_fs, writes);

	set_bit(BCH_FS_write_disable_complete, &c->flags);
	wake_up(&bch2_read_only_wait);
}
#endif

void bch2_fs_read_only(struct bch_fs *c)
{}

static void bch2_fs_read_only_work(struct work_struct *work)
{}

static void bch2_fs_read_only_async(struct bch_fs *c)
{}

bool bch2_fs_emergency_read_only(struct bch_fs *c)
{}

static int bch2_fs_read_write_late(struct bch_fs *c)
{}

static int __bch2_fs_read_write(struct bch_fs *c, bool early)
{}

int bch2_fs_read_write(struct bch_fs *c)
{}

int bch2_fs_read_write_early(struct bch_fs *c)
{}

/* Filesystem startup/shutdown: */

static void __bch2_fs_free(struct bch_fs *c)
{}

static void bch2_fs_release(struct kobject *kobj)
{}

void __bch2_fs_stop(struct bch_fs *c)
{}

void bch2_fs_free(struct bch_fs *c)
{}

void bch2_fs_stop(struct bch_fs *c)
{}

static int bch2_fs_online(struct bch_fs *c)
{}

static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
{}

noinline_for_stack
static void print_mount_opts(struct bch_fs *c)
{}

int bch2_fs_start(struct bch_fs *c)
{}

static int bch2_dev_may_add(struct bch_sb *sb, struct bch_fs *c)
{}

static int bch2_dev_in_fs(struct bch_sb_handle *fs,
			  struct bch_sb_handle *sb,
			  struct bch_opts *opts)
{}

/* Device startup/shutdown: */

static void bch2_dev_release(struct kobject *kobj)
{}

static void bch2_dev_free(struct bch_dev *ca)
{}

static void __bch2_dev_offline(struct bch_fs *c, struct bch_dev *ca)
{}

#ifndef CONFIG_BCACHEFS_DEBUG
static void bch2_dev_ref_complete(struct percpu_ref *ref)
{
	struct bch_dev *ca = container_of(ref, struct bch_dev, ref);

	complete(&ca->ref_completion);
}
#endif

static void bch2_dev_io_ref_complete(struct percpu_ref *ref)
{}

static int bch2_dev_sysfs_online(struct bch_fs *c, struct bch_dev *ca)
{}

static struct bch_dev *__bch2_dev_alloc(struct bch_fs *c,
					struct bch_member *member)
{}

static void bch2_dev_attach(struct bch_fs *c, struct bch_dev *ca,
			    unsigned dev_idx)
{}

static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
{}

static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb)
{}

static int bch2_dev_attach_bdev(struct bch_fs *c, struct bch_sb_handle *sb)
{}

/* Device management: */

/*
 * Note: this function is also used by the error paths - when a particular
 * device sees an error, we call it to determine whether we can just set the
 * device RO, or - if this function returns false - we'll set the whole
 * filesystem RO:
 *
 * XXX: maybe we should be more explicit about whether we're changing state
 * because we got an error or what have you?
 */
bool bch2_dev_state_allowed(struct bch_fs *c, struct bch_dev *ca,
			    enum bch_member_state new_state, int flags)
{}

static bool bch2_fs_may_start(struct bch_fs *c)
{}

static void __bch2_dev_read_only(struct bch_fs *c, struct bch_dev *ca)
{}

static void __bch2_dev_read_write(struct bch_fs *c, struct bch_dev *ca)
{}

int __bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
			 enum bch_member_state new_state, int flags)
{}

int bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
		       enum bch_member_state new_state, int flags)
{}

/* Device add/removal: */

static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
{}

int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
{}

/* Add new device to running filesystem: */
int bch2_dev_add(struct bch_fs *c, const char *path)
{}

/* Hot add existing device to running filesystem: */
int bch2_dev_online(struct bch_fs *c, const char *path)
{}

int bch2_dev_offline(struct bch_fs *c, struct bch_dev *ca, int flags)
{}

int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets)
{}

/* return with ref on ca->ref: */
struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *name)
{}

/* Filesystem open: */

static inline int sb_cmp(struct bch_sb *l, struct bch_sb *r)
{}

struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
			    struct bch_opts opts)
{}

/* Global interfaces/init */

static void bcachefs_exit(void)
{}

static int __init bcachefs_init(void)
{}

#define BCH_DEBUG_PARAM
BCH_DEBUG_PARAMS()
#undef BCH_DEBUG_PARAM

__maybe_unused
static unsigned bch2_metadata_version =;
module_param_named(version, bch2_metadata_version, uint, 0400);

module_exit(bcachefs_exit);
module_init();