]> git.hungrycats.org Git - linux/commit
btrfs: stripe_alloc: charge relocation a margin per reservation, not per extent
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 5 Sep 2026 18:50:03 +0000 (14:50 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Wed, 16 Sep 2026 21:40:05 +0000 (17:40 -0400)
commitb7d7ae704c5d0af59df748603a04d7677bad96b7
tree4170c19369059373791032e2ca0dd558a14b44bf
parent499ca8fdf310bdf6f6a7119cd5c50adce2d6542f
btrfs: stripe_alloc: charge relocation a margin per reservation, not per extent

The stripe margin is one full stripe per outstanding extent, collateral
for the tails a commit traps under delalloc that has not been placed
yet.  The data relocation inode charged it too, for extents that are
already allocated: relocating a group of 16-48K files inflated
bytes_stripe_margin to 150 MB, more than the claimable supply, so the
next cluster reservation failed at once and the reclaim trigger retried
the same six groups 130 times in 15 minutes while the margin swung
between zero and 150 MB with nothing dirty.

Do not charge the per-extent margin for the data relocation root.
Instead, when a relocation reservation is checked against the
whole-stripe supply, round it up to whole stripes and add one stripe of
collateral, which is what relocation's own open runs can lose at the
next commit.

Assisted-by: Claude:claude-fable-5
fs/btrfs/space-info.c