#include "bcache.h"
#include "sysfs.h"
#include "btree.h"
#include "request.h"
#include "writeback.h"
#include "features.h"
#include <linux/blkdev.h>
#include <linux/sort.h>
#include <linux/sched/clock.h>
extern bool bcache_is_reboot;
static const char * const bch_cache_modes[] = …;
static const char * const bch_reada_cache_policies[] = …;
static const char * const bch_stop_on_failure_modes[] = …;
static const char * const cache_replacement_policies[] = …;
static const char * const error_actions[] = …;
write_attribute(attach);
write_attribute(detach);
write_attribute(unregister);
write_attribute(stop);
write_attribute(clear_stats);
write_attribute(trigger_gc);
write_attribute(prune_cache);
write_attribute(flash_vol_create);
read_attribute(bucket_size);
read_attribute(block_size);
read_attribute(nbuckets);
read_attribute(tree_depth);
read_attribute(root_usage_percent);
read_attribute(priority_stats);
read_attribute(btree_cache_size);
read_attribute(btree_cache_max_chain);
read_attribute(cache_available_percent);
read_attribute(written);
read_attribute(btree_written);
read_attribute(metadata_written);
read_attribute(active_journal_entries);
read_attribute(backing_dev_name);
read_attribute(backing_dev_uuid);
sysfs_time_stats_attribute(btree_gc, sec, ms);
sysfs_time_stats_attribute(btree_split, sec, us);
sysfs_time_stats_attribute(btree_sort, ms, us);
sysfs_time_stats_attribute(btree_read, ms, us);
read_attribute(btree_nodes);
read_attribute(btree_used_percent);
read_attribute(average_key_size);
read_attribute(dirty_data);
read_attribute(bset_tree_stats);
read_attribute(feature_compat);
read_attribute(feature_ro_compat);
read_attribute(feature_incompat);
read_attribute(state);
read_attribute(cache_read_races);
read_attribute(reclaim);
read_attribute(reclaimed_journal_buckets);
read_attribute(flush_write);
read_attribute(writeback_keys_done);
read_attribute(writeback_keys_failed);
read_attribute(io_errors);
read_attribute(congested);
read_attribute(cutoff_writeback);
read_attribute(cutoff_writeback_sync);
rw_attribute(congested_read_threshold_us);
rw_attribute(congested_write_threshold_us);
rw_attribute(sequential_cutoff);
rw_attribute(data_csum);
rw_attribute(cache_mode);
rw_attribute(readahead_cache_policy);
rw_attribute(stop_when_cache_set_failed);
rw_attribute(writeback_metadata);
rw_attribute(writeback_running);
rw_attribute(writeback_percent);
rw_attribute(writeback_delay);
rw_attribute(writeback_rate);
rw_attribute(writeback_consider_fragment);
rw_attribute(writeback_rate_update_seconds);
rw_attribute(writeback_rate_i_term_inverse);
rw_attribute(writeback_rate_p_term_inverse);
rw_attribute(writeback_rate_fp_term_low);
rw_attribute(writeback_rate_fp_term_mid);
rw_attribute(writeback_rate_fp_term_high);
rw_attribute(writeback_rate_minimum);
read_attribute(writeback_rate_debug);
read_attribute(stripe_size);
read_attribute(partial_stripes_expensive);
rw_attribute(synchronous);
rw_attribute(journal_delay_ms);
rw_attribute(io_disable);
rw_attribute(discard);
rw_attribute(running);
rw_attribute(label);
rw_attribute(errors);
rw_attribute(io_error_limit);
rw_attribute(io_error_halflife);
rw_attribute(verify);
rw_attribute(bypass_torture_test);
rw_attribute(key_merging_disabled);
rw_attribute(gc_always_rewrite);
rw_attribute(expensive_debug_checks);
rw_attribute(cache_replacement_policy);
rw_attribute(btree_shrinker_disabled);
rw_attribute(copy_gc_enabled);
rw_attribute(idle_max_writeback_rate);
rw_attribute(gc_after_writeback);
rw_attribute(size);
static ssize_t bch_snprint_string_list(char *buf,
size_t size,
const char * const list[],
size_t selected)
{ … }
SHOW(__bch_cached_dev)
{ … }
SHOW_LOCKED(bch_cached_dev)
STORE(__cached_dev)
{ … }
STORE(bch_cached_dev)
{ … }
static struct attribute *bch_cached_dev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
KTYPE(…);
SHOW(bch_flash_dev)
{ … }
STORE(__bch_flash_dev)
{ … }
STORE_LOCKED(bch_flash_dev)
static struct attribute *bch_flash_dev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
KTYPE(…);
struct bset_stats_op { … };
static int bch_btree_bset_stats(struct btree_op *b_op, struct btree *b)
{ … }
static int bch_bset_print_stats(struct cache_set *c, char *buf)
{ … }
static unsigned int bch_root_usage(struct cache_set *c)
{ … }
static size_t bch_cache_size(struct cache_set *c)
{ … }
static unsigned int bch_cache_max_chain(struct cache_set *c)
{ … }
static unsigned int bch_btree_used(struct cache_set *c)
{ … }
static unsigned int bch_average_key_size(struct cache_set *c)
{ … }
SHOW(__bch_cache_set)
{ … }
SHOW_LOCKED(bch_cache_set)
STORE(__bch_cache_set)
{ … }
STORE_LOCKED(bch_cache_set)
SHOW(bch_cache_set_internal)
{ … }
STORE(bch_cache_set_internal)
{ … }
static void bch_cache_set_internal_release(struct kobject *k)
{ … }
static struct attribute *bch_cache_set_attrs[] = …;
ATTRIBUTE_GROUPS(…);
KTYPE(…);
static struct attribute *bch_cache_set_internal_attrs[] = …;
ATTRIBUTE_GROUPS(…);
KTYPE(…);
static int __bch_cache_cmp(const void *l, const void *r)
{ … }
SHOW(__bch_cache)
{ … }
SHOW_LOCKED(bch_cache)
STORE(__bch_cache)
{ … }
STORE_LOCKED(bch_cache)
static struct attribute *bch_cache_attrs[] = …;
ATTRIBUTE_GROUPS(…);
KTYPE(…);