Debugging tools
Sysfs interface
Mounted filesystems are available in sysfs at
/sys/fs/bcachefs/<uuid>/ with various options, performance counters
and internal debugging aids.
Options
/sys/fs/bcachefs/<uuid>/options/, and settings changed via sysfs
will be persistently changed in the superblock as well.Time stats
bcachefs tracks the latency and frequency of various operations and
events, with quantiles for latency/duration in the
/sys/fs/bcachefs/<uuid>/time_stats/ directory.
blocked_allocateblocked_allocate_open_bucketblocked_journalbtree_gcbtree_lock_contended_read
btree_lock_contended_intent
btree_lock_contended_writebtree_node_mem_allocbtree_node_splitbtree_node_compactbtree_node_mergebtree_node_sortbtree_node_readbtree_interior_update_foregroundbtree_interior_update_totaldata_readdata_writedata_promotepromote_target. This is done asynchronously from the original
read.journal_flush_writejournal_noflush_writejournal_flush_seqInternals
btree_cachedirty_btree_nodesFor each dirty btree node, prints:
Whether the
need_writeflag is setThe level of the btree node
The number of sectors written
Whether writing this node is blocked, waiting for other nodes to be written
Whether it is waiting on a btree_update to complete and make it reachable on-disk
btree_key_cachebtree_transactionsbtree_updatesjournal_debugjournal_pins Lists items pinning journal entries, preventing them
from being reclaimed.
new_stripesstripes_heapopen_bucketsio_timers_readio_timers_writetrigger_journal_flushtrigger_gcprune_cacheread_realloc_racesextent_migrate_doneextent_migrate_racedUnit and performance tests
Echoing into /sys/fs/bcachefs/<uuid>/perf_test runs various low
level btree tests, some intended as unit tests and others as performance
tests. The syntax is
echo <test_name> <nr_iterations> <nr_threads> > perf_test
When complete, the elapsed time will be printed in the dmesg log. The
full list of tests that can be run can be found near the bottom of
fs/bcachefs/tests.c.
Debugfs interface
The contents of every btree, as well as various internal per-btree-node
information, are available under /sys/kernel/debug/bcachefs/<uuid>/.
For every btree, we have the following files:
-formats-bfloat-failedListing and dumping filesystem metadata
bcachefs show-super
This subcommand is used for examining and printing bcachefs superblocks. It takes two optional parameters:
-l: Print superblock layout, which records the amount of space
reserved for the superblock and the locations of the backup
superblocks.
-f, –fields=(fields): List of superblock sections to print,
all to print all sections.
bcachefs list
This subcommand gives access to the same functionality as the debugfs interface, listing btree nodes and contents, but for offline filesystems.
bcachefs list_journal
This subcommand lists the contents of the journal, which primarily records btree updates ordered by when they occured.
bcachefs dump
This subcommand can dump all metadata in a filesystem (including multi
device filesystems) as qcow2 images: when encountering issues that
fsck can not recover from and need attention from the developers,
this makes it possible to send the developers only the required
metadata. Encrypted filesystems must first be unlocked with
bcachefs remove-passphrase.