]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: zoned: fixup last alloc pointer after extent removal for DUP
authorNaohiro Aota <naohiro.aota@wdc.com>
Fri, 23 Jan 2026 12:41:35 +0000 (21:41 +0900)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:21 +0000 (07:21 -0500)
commitf4951c56d59c2f07cbefeb4b6bac75c58d364af1
tree7304f693bab94f559e566d5b29a7358d65755997
parent72f6529487a378d24d664167076d85d8f30c12d1
btrfs: zoned: fixup last alloc pointer after extent removal for DUP

[ Upstream commit e2d848649e64de39fc1b9c64002629b4daa1105d ]

When a block group is composed of a sequential write zone and a
conventional zone, we recover the (pseudo) write pointer of the
conventional zone using the end of the last allocated position.

However, if the last extent in a block group is removed, the last extent
position will be smaller than the other real write pointer position.
Then, that will cause an error due to mismatch of the write pointers.

We can fixup this case by moving the alloc_offset to the corresponding
write pointer position.

Fixes: c0d90a79e8e6 ("btrfs: zoned: fix alloc_offset calculation for partly conventional block groups")
CC: stable@vger.kernel.org # 6.16+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/zoned.c