]> git.hungrycats.org Git - linux/commit
btrfs: stripe_alloc: log the space counters when data writeback hits ENOSPC
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 25 Oct 2026 08:48:50 +0000 (04:48 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 2 Nov 2026 02:16:30 +0000 (21:16 -0500)
commita1c3aceaf1905ab7da5bb8e64c249edcb3ca8353
treedc41557ecdedbccc2531144fc3abf5b62166597a
parent653d25e0405c08fda7ecffa69501806167e2f74b
btrfs: stripe_alloc: log the space counters when data writeback hits ENOSPC

A data writeback allocation that fails with ENOSPC under stripe_alloc
drops the buffered data in its range.  The reservation margin is meant to
make that impossible, so the warning is the only evidence that admission
and the allocator disagreed, and today it names only the allocation size.
A drop seen once in a long test cannot be explained afterwards.

Log what admission decided on in the same line: the whole-stripe supply
(claimable, the part dedicated to relocation, unmanaged free space), what
is held against it (may_use, the outstanding extents' margin), the open,
trapped and stranded bytes, reserved and total, and the margin unit.  The
"despite reservation margin" wording is kept, so existing log scanners
still match it.

On CONFIG_BTRFS_DEBUG builds, also log one line per block group with its
full stripe length, claimable bytes, largest known claimable run, open
remainder and trapped and stranded bytes.  Unlike btrfs_dump_space_info()
this walks no free space entries.  It takes groups_sem for read and each
group's lock, as the ENOSPC_DEBUG dump a few lines above already does at
this call site, so it adds no lock ordering.

The line and the walk share one rate limit, so a burst of failures cannot
flood the log with group lines.

Assisted-by: Claude:claude-opus-5-5
fs/btrfs/extent-tree.c
fs/btrfs/space-info.c
fs/btrfs/space-info.h