From: Boris Burkov <boris@bur.io>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>,
David Sterba <dsterba@suse.com>,
Hans Holmberg <Hans.Holmberg@wdc.com>,
Damien Le Moal <dlemoal@kernel.org>,
Naohiro Aota <naohiro.aota@wdc.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 0/7] btrfs: fixes around generic/747 on zoned filesystems
Date: Thu, 14 May 2026 07:43:48 -0700 [thread overview]
Message-ID: <20260514144348.GA1197064@zen.localdomain> (raw)
In-Reply-To: <20260513123445.43197-1-johannes.thumshirn@wdc.com>
On Wed, May 13, 2026 at 02:34:38PM +0200, Johannes Thumshirn wrote:
> 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
"can starvation" reads like a typo or lost sentence edit
> 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
>
prev parent reply other threads:[~2026-05-14 14:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Boris Burkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260514144348.GA1197064@zen.localdomain \
--to=boris@bur.io \
--cc=Hans.Holmberg@wdc.com \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox