diff options
author | Christoph Hellwig <hch@lst.de> | 2024-12-13 09:43:43 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-01-06 18:32:35 +0300 |
commit | 7467bc5959bf02ef5210ea7e7948e548565c799c (patch) | |
tree | 8f0c63703831d4907af3c69c7d92884fcf4bac10 /rust/kernel | |
parent | 6aecd91a5c5b68939cf4169e32bc49f3cd2dd329 (diff) | |
download | linux-7467bc5959bf02ef5210ea7e7948e548565c799c.tar.xz |
btrfs: zoned: calculate max_extent_size properly on non-zoned setup
Since commit 559218d43ec9 ("block: pre-calculate max_zone_append_sectors"),
queue_limits's max_zone_append_sectors is default to be 0 and it is only
updated when there is a zoned device. So, we have
lim->max_zone_append_sectors = 0 when there is no zoned device in the
filesystem.
That leads to fs_info->max_zone_append_size and thus
fs_info->max_extent_size to be 0, which is wrong and can for example
lead to a divide by zero in count_max_extents().
Fix this by only capping fs_info->max_extent_size to
fs_info->max_zone_append_size when it is non-zero.
Based on a patch from Naohiro Aota <naohiro.aota@wdc.com>, from which
much of this commit message is stolen as well.
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: 559218d43ec9 ("block: pre-calculate max_zone_append_sectors")
Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'rust/kernel')
0 files changed, 0 insertions, 0 deletions