]> git.hungrycats.org Git - linux/commit
btrfs: add a new 'stripe_len' parameter to btrfs_stripe_nr_to_offset()
authorQu Wenruo <wqu@suse.com>
Wed, 21 Oct 2026 03:39:39 +0000 (14:09 +1030)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:18 +0000 (21:36 +0100)
commiteee8a3ff327a46230419c712865e44d53ed57a1d
tree918f9f6b06f6eaaa730119fab96b3d4e9406984e
parent99b4c45fe5dd412b24f6f967ba165b6b7369aaa8
btrfs: add a new 'stripe_len' parameter to btrfs_stripe_nr_to_offset()

That helper is currently using a fixed BTRFS_STRIPE_LEN, change it to
accept a 'u32 stripe_len'.

Also add an ASSERT() to make sure the @stripe_len passed in is power of
2, and no larger than BTRFS_STRIPE_LEN.

There is a special case where we still pass BTRFS_STRIPE_LEN into
btrfs_stripe_nr_to_offset(), that's for chunk allocation to determine
the minimal device extent size.

In that case, since our future planned map->stripe_len is always power
of 2 and no larger than BTRFS_STRIPE_LEN, we are totally fine to use the
old BTRFS_STRIPE_LEN.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/scrub.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/btrfs/zoned.c