linux/fs/bcachefs/sysfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * bcache sysfs interfaces
 *
 * Copyright 2010, 2011 Kent Overstreet <[email protected]>
 * Copyright 2012 Google, Inc.
 */

#ifndef NO_BCACHEFS_SYSFS

#include "bcachefs.h"
#include "alloc_background.h"
#include "alloc_foreground.h"
#include "sysfs.h"
#include "btree_cache.h"
#include "btree_io.h"
#include "btree_iter.h"
#include "btree_key_cache.h"
#include "btree_update.h"
#include "btree_update_interior.h"
#include "btree_gc.h"
#include "buckets.h"
#include "clock.h"
#include "compress.h"
#include "disk_accounting.h"
#include "disk_groups.h"
#include "ec.h"
#include "inode.h"
#include "journal.h"
#include "journal_reclaim.h"
#include "keylist.h"
#include "move.h"
#include "movinggc.h"
#include "nocow_locking.h"
#include "opts.h"
#include "rebalance.h"
#include "replicas.h"
#include "super-io.h"
#include "tests.h"

#include <linux/blkdev.h>
#include <linux/sort.h>
#include <linux/sched/clock.h>

#include "util.h"

#define SYSFS_OPS(type)

#define SHOW(fn)

#define STORE(fn)

#define __sysfs_attribute(_name, _mode)

#define write_attribute(n)
#define read_attribute(n)
#define rw_attribute(n)

#define sysfs_printf(file, fmt, ...)

#define sysfs_print(file, var)

#define sysfs_hprint(file, val)

#define sysfs_strtoul(file, var)

#define sysfs_strtoul_clamp(file, var, min, max)

#define strtoul_or_return(cp)

write_attribute(trigger_gc);
write_attribute(trigger_discards);
write_attribute(trigger_invalidates);
write_attribute(trigger_journal_flush);
write_attribute(trigger_journal_writes);
write_attribute(trigger_btree_cache_shrink);
write_attribute(trigger_btree_key_cache_shrink);
write_attribute(trigger_freelist_wakeup);
rw_attribute(gc_gens_pos);

read_attribute(uuid);
read_attribute(minor);
read_attribute(flags);
read_attribute(bucket_size);
read_attribute(first_bucket);
read_attribute(nbuckets);
rw_attribute(durability);
read_attribute(io_done);
read_attribute(io_errors);
write_attribute(io_errors_reset);

read_attribute(io_latency_read);
read_attribute(io_latency_write);
read_attribute(io_latency_stats_read);
read_attribute(io_latency_stats_write);
read_attribute(congested);

read_attribute(btree_write_stats);

read_attribute(btree_cache_size);
read_attribute(compression_stats);
read_attribute(journal_debug);
read_attribute(btree_cache);
read_attribute(btree_key_cache);
read_attribute(btree_reserve_cache);
read_attribute(stripes_heap);
read_attribute(open_buckets);
read_attribute(open_buckets_partial);
read_attribute(write_points);
read_attribute(nocow_lock_table);

#ifdef BCH_WRITE_REF_DEBUG
read_attribute(write_refs);

static const char * const bch2_write_refs[] =;

static void bch2_write_refs_to_text(struct printbuf *out, struct bch_fs *c)
{}
#endif

read_attribute(internal_uuid);
read_attribute(disk_groups);

read_attribute(has_data);
read_attribute(alloc_debug);
read_attribute(accounting);
read_attribute(usage_base);

#define x
BCH_PERSISTENT_COUNTERS()
#undef x

rw_attribute(discard);
rw_attribute(label);

rw_attribute(copy_gc_enabled);
read_attribute(copy_gc_wait);

rw_attribute(rebalance_enabled);
sysfs_pd_controller_attribute();
read_attribute(rebalance_status);
rw_attribute(promote_whole_extents);

read_attribute(new_stripes);

read_attribute(io_timers_read);
read_attribute(io_timers_write);

read_attribute(moving_ctxts);

#ifdef CONFIG_BCACHEFS_TESTS
write_attribute(perf_test);
#endif /* CONFIG_BCACHEFS_TESTS */

#define x
	BCH_TIME_STATS()
#undef x

static struct attribute sysfs_state_rw =;

static size_t bch2_btree_cache_size(struct bch_fs *c)
{}

static int bch2_compression_stats_to_text(struct printbuf *out, struct bch_fs *c)
{}

static void bch2_gc_gens_pos_to_text(struct printbuf *out, struct bch_fs *c)
{}

static void bch2_fs_usage_base_to_text(struct printbuf *out, struct bch_fs *c)
{}

SHOW(bch2_fs)
{}

STORE(bch2_fs)
{}
SYSFS_OPS();

struct attribute *bch2_fs_files[] =;

/* counters dir */

SHOW(bch2_fs_counters)
{}

STORE(bch2_fs_counters) {}

SYSFS_OPS();

struct attribute *bch2_fs_counters_files[] =;
/* internal dir - just a wrapper */

SHOW(bch2_fs_internal)
{}

STORE(bch2_fs_internal)
{}
SYSFS_OPS();

struct attribute *bch2_fs_internal_files[] =;

/* options */

SHOW(bch2_fs_opts_dir)
{}

STORE(bch2_fs_opts_dir)
{}
SYSFS_OPS();

struct attribute *bch2_fs_opts_dir_files[] =;

int bch2_opts_create_sysfs_files(struct kobject *kobj)
{}

/* time stats */

SHOW(bch2_fs_time_stats)
{}

STORE(bch2_fs_time_stats)
{}
SYSFS_OPS();

struct attribute *bch2_fs_time_stats_files[] =;

static const char * const bch2_rw[] =;

static void dev_io_done_to_text(struct printbuf *out, struct bch_dev *ca)
{}

SHOW(bch2_dev)
{}

STORE(bch2_dev)
{}
SYSFS_OPS();

struct attribute *bch2_dev_files[] =;

#endif  /* _BCACHEFS_SYSFS_H_ */