public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: unbalanced disks aware per-profile available space estimation
@ 2026-02-03  3:01 Qu Wenruo
  2026-02-03  3:01 ` [PATCH 1/3] btrfs: introduce the device layout aware per-profile available space Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Qu Wenruo @ 2026-02-03  3:01 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v1:
- Revive from the v5.9 era fix

- Make btrfs_update_per_profile_avail() to not return error
  Instead just mark all profiles as unavailable, and
  btrfs_get_per_profile_avail() will return false.

  The caller will need to fallback to the existing factor based
  estimation.

  This greatly simplified the error handling, which is a pain point in
  the original series.

- Remove a lot of refactor/cleanup
  As that's already done in upstream.

- Only make calc_available_free_space() to use the new infrastructure
  That's the main goal, fix can_over_commit().
  Further enhancement can be done later.

There is a long known bug that if metadata is using RAID1 on two
unbalanced disks, btrfs have a very high chance to hit -ENOSPC during
critical paths and flips RO.

The bug dates back to v5.9 (where my last updates ends) and the most
recent bug report is from Christoph.

The idea to fix it is always here, by providing a chunk-allocator-like
available space estimation.
It doesn't need to be as heavy as chunk allocator, but at least it
should not over-estimate.


The demon is always in the details, the previous v5.9 era series
requires a lot of changes in error handling, because the
btrfs_update_per_profile_avail() can fail at critical paths in chunk
allocation/removal and device grow/shrink/add/removal.

But this time that function will no longer fail, but just mark
per-profile available estimation as unreliable, and let the caller to
fallback to the old factor based solution.

In the real world it should not be a big deal, as the only error is
-ENOMEM, but this greatly simplifies the error handling.

Qu Wenruo (3):
  btrfs: introduce the device layout aware per-profile available space
  btrfs: update per-profile available estimation
  btrfs: use per-profile available space in calc_available_free_space()

 fs/btrfs/space-info.c |  27 ++++---
 fs/btrfs/volumes.c    | 173 +++++++++++++++++++++++++++++++++++++++++-
 fs/btrfs/volumes.h    |  30 ++++++++
 3 files changed, 217 insertions(+), 13 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-02-03 23:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03  3:01 [PATCH 0/3] btrfs: unbalanced disks aware per-profile available space estimation Qu Wenruo
2026-02-03  3:01 ` [PATCH 1/3] btrfs: introduce the device layout aware per-profile available space Qu Wenruo
2026-02-03 12:56   ` Filipe Manana
2026-02-03 20:52     ` Qu Wenruo
2026-02-03 21:47       ` Filipe Manana
2026-02-03 23:49   ` kernel test robot
2026-02-03  3:01 ` [PATCH 2/3] btrfs: update per-profile available estimation Qu Wenruo
2026-02-03  3:01 ` [PATCH 3/3] btrfs: use per-profile available space in calc_available_free_space() Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox