From: "Dongjiang Zhu" <zhudongjiang@fygo.io>
To: <linux-btrfs@vger.kernel.org>
Cc: <johannes.thumshirn@wdc.com>, <naohiro.aota@wdc.com>,
<a2jphilipp@gmail.com>
Subject: [PATCH v4 0/4] btrfs: zoned: fix active-zone accounting and transitions
Date: Wed, 25 Nov 2026 18:21:27 +0800 [thread overview]
Message-ID: <cover.1795600611.git.zhudongjiang@fygo.io> (raw)
This series addresses active-zone accounting and block group
transitions on zoned devices. It simplifies conventional-zone handling,
restores metadata/system write roles at mount, and addresses a
balance self-deadlock and a race during zone finishing.
The four patches:
1. Track only sequential zones as active.
2. Restore the normal metadata and system write roles at mount,
keeping one active block group for each role and finishing the
remaining active non-data block groups.
3. Remove obsolete allocation-time non-data activation, leaving
activation and role switching to the writeback path.
4. Serialize concurrent finish operations on the same block group,
keeping it active until the device operations and active-list
cleanup complete.
Jochen Philipp tested a rebased version of this series on his
filesystem. He reported writing another 2.3 TB via rsync without
Btrfs errors, a clean unmount, no errors from btrfs check --readonly,
and a successful read-write mount afterwards. Many thanks to Jochen
for the extensive testing.
Changes in v4:
- Rebased onto btrfs for-next at 7bfc2c517eac.
- Retained the upstream active-zone bitmap check for mount-time
reservation accounting and the conditional reservation updates
during activation and finishing.
- Moved abandoned-tail accounting into do_zone_finish(), alongside
the alloc_offset update, preserving read-only block group accounting.
- Removed the unnecessary temporary block group references in
mount-time cleanup.
- Updated the commit messages to reflect the current base and clarify
the role-recovery and zone-finishing behavior.
Changes in v3:
- Dropped the block-group flag comment changes from patch 1; no
functional changes.
Changes in v2:
- Removed the [BUG], [CAUSE] and [FIX] headings from the commit messages.
- Added a helper for identifying zones that need active-zone tracking.
- Added block group locking around alloc_offset and zone_unusable
accesses during mount recovery.
- Explained why moving the active-bit clear alone does not serialize
concurrent zone finish operations.
Previous versions:
v3: https://lore.kernel.org/linux-btrfs/cover.1787887776.git.zhudongjiang@fygo.io/
v2: https://lore.kernel.org/linux-btrfs/cover.1787717573.git.zhudongjiang@fygo.io/
v1: https://lore.kernel.org/linux-btrfs/cover.1787551793.git.zhudongjiang@fygo.io/
Dongjiang Zhu (4):
btrfs: zoned: track only sequential zones as active
btrfs: zoned: recover active non-data block group roles on mount
btrfs: zoned: remove obsolete non-data block group activation helper
btrfs: zoned: serialize zone finishing per block group
fs/btrfs/block-group.c | 38 ++------
fs/btrfs/block-group.h | 1 +
fs/btrfs/disk-io.c | 7 +-
fs/btrfs/zoned.c | 211 +++++++++++++++++++++++++++++------------
fs/btrfs/zoned.h | 9 +-
5 files changed, 167 insertions(+), 99 deletions(-)
--
2.39.5
next reply other threads:[~2026-11-25 10:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 10:21 Dongjiang Zhu [this message]
2026-11-25 10:21 ` [PATCH v4 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
2026-11-25 10:21 ` [PATCH v4 2/4] btrfs: zoned: recover active non-data block group roles on mount Dongjiang Zhu
2026-12-02 9:08 ` Johannes Thumshirn
2026-12-02 9:25 ` Johannes Thumshirn
2026-12-02 10:16 ` Dongjiang Zhu
2026-12-02 11:25 ` Johannes Thumshirn
2026-12-03 10:21 ` Dongjiang Zhu
2026-11-25 10:21 ` [PATCH v4 3/4] btrfs: zoned: remove obsolete non-data block group activation helper Dongjiang Zhu
2026-11-25 10:21 ` [PATCH v4 4/4] btrfs: zoned: serialize zone finishing per block group Dongjiang Zhu
2026-12-02 11:26 ` Johannes Thumshirn
2026-12-02 11:46 ` Dongjiang Zhu
2026-12-02 15:03 ` Johannes Thumshirn
2026-11-27 13:34 ` [PATCH v4 0/4] btrfs: zoned: fix active-zone accounting and transitions Jochen Philipp
2026-11-30 7:09 ` Dongjiang Zhu
2026-11-30 15:00 ` Jochen Philipp
2026-12-02 10:11 ` Dongjiang Zhu
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=cover.1795600611.git.zhudongjiang@fygo.io \
--to=zhudongjiang@fygo.io \
--cc=a2jphilipp@gmail.com \
--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