]> git.hungrycats.org Git - linux/commit
btrfs: stripe_meta: back the global reserve with usable stripes, and say when a tree...
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 5 Sep 2026 09:59:56 +0000 (05:59 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Wed, 16 Sep 2026 21:40:05 +0000 (17:40 -0400)
commit6469f2f464052a179d557c616a29ac65a8791168
treea57ce2ff02df27defa286312a5d9cff611d55537
parent011f895fd72295880437f398f9ad13b16695b300
btrfs: stripe_meta: back the global reserve with usable stripes, and say when a tree block finds none

With trapped and open-run bytes counted as used in the METADATA
space_info, the overcommit check already admits tree block reservations
only against whole free stripes plus unallocated space, so no separate
metadata gate is needed.  Two loose ends remain.

btrfs_update_global_block_rsv() forces a chunk allocation when the
global reserve is at least the space_info's total, but under stripe_meta
the reserve can only be spent in whole stripes: compare it against the
capacity minus the trapped bytes so a metadata chunk is allocated while
unallocated space still exists, instead of the reserve running dry at
the fill edge.

And when a raid56 stripe_meta tree block allocation does fail with
ENOSPC -- which aborts the transaction -- print the stripe counters,
the metadata twin of the data-side "returned ENOSPC despite reservation
margin" warning, so an accounting hole is identifiable from the log.

Assisted-by: Claude:claude-fable-5
fs/btrfs/block-rsv.c
fs/btrfs/extent-tree.c