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_allocate
blocked_allocate_open_bucket
blocked_journal
btree_gc
btree_lock_contended_read
btree_lock_contended_intent
btree_lock_contended_write
btree_node_mem_alloc
btree_node_split
btree_node_compact
btree_node_merge
btree_node_sort
btree_node_read
btree_interior_update_foreground
btree_interior_update_total
data_read
data_write
data_promote
promote_target
. This is done asynchronously from the original
read.journal_flush_write
journal_noflush_write
journal_flush_seq
Internals
btree_cache
dirty_btree_nodes
For each dirty btree node, prints:
Whether the
need_write
flag 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_cache
btree_transactions
btree_updates
journal_debug
journal_pins
Lists items pinning journal entries, preventing them
from being reclaimed.
new_stripes
stripes_heap
open_buckets
io_timers_read
io_timers_write
trigger_journal_flush
trigger_gc
prune_cache
read_realloc_races
extent_migrate_done
extent_migrate_raced
Unit 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-failed
Listing 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
.