]> git.hungrycats.org Git - linux/commit
btrfs: stripe_alloc: tell a dead tree block from a live one in the metadata RMW audit
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 6 Sep 2026 13:01:40 +0000 (09:01 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 18 Sep 2026 21:36:28 +0000 (17:36 -0400)
commit8526238145d52bbbd2fc9d1a185777890ae5b8e3
tree8a4fbfe3aad1128823b357a80a0c31b28cd43b1e
parent8c58b282da6fe578975e614aa92a1cc2fa3d8080
btrfs: stripe_alloc: tell a dead tree block from a live one in the metadata RMW audit

The audit reports any older-generation header under a read-modify-write
as a write hole, and counted over six hundred per metadata fill test.
Since runs close at every transaction and freed stripes are reclaimed
whole, most such headers belong to blocks that died with their stripe:
the stripe was claimed fully free, the dead blocks kept their headers,
and a torn parity write over them damages nothing a reader can reach.

Ask the committed extent tree, the witness a degraded read after a
crash would consult, whether the block is still referenced.  Count and
report a live one as before (now with its bytenr and reference count),
and count a dead one as meta_rmw_ghost without a warning.

A sector the run has already re-allocated in the current transaction
carries an extent item of the current generation for the new block
while the old header is still on disk (the new write has not landed):
that is not a live block either, so the item generation must match the
header generation.  Without that check every single-stripe run of the
current transaction reported its dead predecessors as holes (90 of 135
warnings in one fill test; the other 45 were the raid5 system chunk).

Assisted-by: Claude:claude-fable-5
fs/btrfs/fs.h
fs/btrfs/raid56.c
fs/btrfs/sysfs.c