mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
f2fs: Fix discard bug on zoned block devices with 2MiB zone size
When using f2fs on a zoned block device with 2MiB zone size, IO errors occurs because f2fs tries to write data to a zone that has not been reset. The cause is that f2fs tries to discard multiple zones at once. This is caused by a condition in f2fs_clear_prefree_segments that does not check for zoned block devices when setting the discard range. This leads to invalid reset commands and write pointer mismatches. This patch fixes the zoned block device with 2MiB zone size to reset one zone at a time. Signed-off-by: Yonggil Song <yonggil.song@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
bf21acf995
commit
6797ebc4ac
@ -2069,7 +2069,9 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
|
||||
(end - 1) <= cpc->trim_end)
|
||||
continue;
|
||||
|
||||
if (!f2fs_lfs_mode(sbi) || !__is_large_section(sbi)) {
|
||||
/* Should cover 2MB zoned device for zone-based reset */
|
||||
if (!f2fs_sb_has_blkzoned(sbi) &&
|
||||
(!f2fs_lfs_mode(sbi) || !__is_large_section(sbi))) {
|
||||
f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
|
||||
(end - start) << sbi->log_blocks_per_seg);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user