Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/7] btrfs: fixes around generic/747 on zoned filesystems
@ 2026-05-13 12:34 Johannes Thumshirn
  2026-05-13 12:34 ` [PATCH 1/7] btrfs: zoned: document RECLAIM_ZONES flush state Johannes Thumshirn
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2026-05-13 12:34 UTC (permalink / raw)
  To: linux-btrfs
  Cc: Filipe Manana, David Sterba, Hans Holmberg, Boris Burkov,
	Damien Le Moal, Naohiro Aota, Christoph Hellwig,
	Johannes Thumshirn

This series fixes premature ENOSPC errors and starvation issues on zoned BTRFS
filesystems when running xfstest generic/747, which tests garbage collection
on zoned block devices using direct and buffered I/O.

The investigation revealed two distinct issues:

1. Async reclaim starvation: On zoned filesystems, the flush state machine
   only executes RECLAIM_ZONES and RESET_ZONES in later flush states
   (FLUSH_DELALLOC and beyond). By the time these states are reached,
   ticket waiters can starvation waiting for space that can only be freed
   by zone reset. The fix adds RECLAIM_ZONES and RESET_ZONES to the first
   async reclaim loop (FLUSH_ALLOC) specifically for zoned filesystems,
   ensuring zone reset happens early enough to free space for pending
   allocation tickets.

2. Inaccurate statfs reporting: On zoned filesystems, space in block
   groups that has been freed but not yet reset is tracked in
   bytes_zone_unusable. This space cannot be used for new allocations
   until zone reclaim resets the zones, but it was being reported as
   available space in statfs. This caused statfs to over-report free
   space, leading to ENOSPC errors when applications tried to allocate
   based on the reported free space. The fix subtracts bytes_zone_unusable
   from total_free_data in the statfs calculation for zoned filesystems,
   with proper RAID factor multiplication for unit conversion.

Additionally, the series fixes a bug in data relocation block group selection
where the first block group was incorrectly skipped, and adds a new flush
state (BTRFS_RESERVE_FLUSH_DATA_RELOCATION) to use priority reclaim for
zoned data relocation operations.


Johannes Thumshirn (7):
  btrfs: zoned: document RECLAIM_ZONES flush state
  btrfs: zoned: decode 'RECLAIM_ZONES' state in tracepoints
  btrfs: zoned: always set data_relocation_bg
  btrfs: zoned: don't account data relocation space-info in statfs free
    space
  btrfs: zoned: subtract zone_unusable space in statfs
  btrfs: zoned: fix deadlock waiting for ticket during data relocation
  btrfs: zoned: add RECLAIM_ZONES and RESET_ZONES to first async reclaim
    loop

 fs/btrfs/delalloc-space.c    |  2 ++
 fs/btrfs/space-info.c        | 18 ++++++++++++++++++
 fs/btrfs/space-info.h        | 11 +++++++++++
 fs/btrfs/super.c             |  5 ++++-
 fs/btrfs/zoned.c             |  6 +++---
 include/trace/events/btrfs.h |  1 +
 6 files changed, 39 insertions(+), 4 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-05-14 14:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 12:34 [PATCH 0/7] btrfs: fixes around generic/747 on zoned filesystems Johannes Thumshirn
2026-05-13 12:34 ` [PATCH 1/7] btrfs: zoned: document RECLAIM_ZONES flush state Johannes Thumshirn
2026-05-14 14:44   ` Boris Burkov
2026-05-13 12:34 ` [PATCH 2/7] btrfs: zoned: decode 'RECLAIM_ZONES' state in tracepoints Johannes Thumshirn
2026-05-13 12:34 ` [PATCH 3/7] btrfs: zoned: always set data_relocation_bg Johannes Thumshirn
2026-05-14  5:42   ` Damien Le Moal
2026-05-14 14:54   ` Boris Burkov
2026-05-13 12:34 ` [PATCH 4/7] btrfs: zoned: don't account data relocation space-info in statfs free space Johannes Thumshirn
2026-05-14  5:42   ` Damien Le Moal
2026-05-13 12:34 ` [PATCH 5/7] btrfs: zoned: subtract zone_unusable space in statfs Johannes Thumshirn
2026-05-14  5:43   ` Damien Le Moal
2026-05-13 12:34 ` [PATCH 6/7] btrfs: zoned: fix deadlock waiting for ticket during data relocation Johannes Thumshirn
2026-05-13 12:34 ` [RFC PATCH 7/7] btrfs: zoned: add RECLAIM_ZONES and RESET_ZONES to first async reclaim loop Johannes Thumshirn
2026-05-14 14:43 ` [PATCH 0/7] btrfs: fixes around generic/747 on zoned filesystems Boris Burkov

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