]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: zoned: fix stripe width calculation
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 16 Sep 2025 02:46:11 +0000 (11:46 +0900)
committerDavid Sterba <dsterba@suse.com>
Wed, 5 Nov 2025 19:00:08 +0000 (20:00 +0100)
commit6a1ab50135ce829b834b448ce49867b5210a1641
tree5ad04e09ae0d4079f28f37306075ae93435cf5f9
parent94f54924b96d3565c6b559294b3401b5496c21ac
btrfs: zoned: fix stripe width calculation

The stripe offset calculation in the zoned code for raid0 and raid10
wrongly uses map->stripe_size to calculate it. In fact, map->stripe_size is
the size of the device extent composing the block group, which always is
the zone_size on the zoned setup.

Fix it by using BTRFS_STRIPE_LEN and BTRFS_STRIPE_LEN_SHIFT. Also, optimize
the calculation a bit by doing the common calculation only once.

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