]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: set pseudo max append zone limit in zone emulation mode
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 26 Aug 2022 07:42:15 +0000 (16:42 +0900)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Sep 2022 13:32:26 +0000 (15:32 +0200)
commitc68c9ca33fa50fb912b5ae015c9e7621bb1fbc00
treedab3026219e586f635378cacca2ca69eee156c5c
parentc19db85c4461494a3218f32a7030aa22e4859f2e
btrfs: zoned: set pseudo max append zone limit in zone emulation mode

The commit f6c20624297b ("btrfs: convert count_max_extents() to use
fs_info->max_extent_size") introduced a division by
fs_info->max_extent_size. This max_extent_size is initialized with max
zone append limit size of the device btrfs runs on. However, in zone
emulation mode, the device is not zoned then its zone append limit is
zero. This resulted in zero value of fs_info->max_extent_size and caused
zero division error.

Fix the error by setting non-zero pseudo value to max append zone limit
in zone emulation mode. Set the pseudo value based on max_segments as
suggested in the commit 12c61611f182 ("btrfs: zoned: revive
max_zone_append_bytes").

Fixes: f6c20624297b ("btrfs: convert count_max_extents() to use fs_info->max_extent_size")
CC: stable@vger.kernel.org # 5.12+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c