diff options
author | 2022-11-29 20:29:28 +0800 | |
---|---|---|
committer | 2023-01-11 11:15:18 -0800 | |
commit | b5a711acab305e04278c136c841ba37c589c16a1 (patch) | |
tree | 77229ac9cfdea262d33157170ff4f58a1206248b /fs/f2fs/super.c | |
parent | f2fs: start freeing cluster pages from the unused number (diff) | |
download | linux-b5a711acab305e04278c136c841ba37c589c16a1.tar.gz linux-b5a711acab305e04278c136c841ba37c589c16a1.tar.bz2 linux-b5a711acab305e04278c136c841ba37c589c16a1.zip |
f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED
The current logic, regardless of whether CONFIG_BLK_DEV_ZONED
is enabled or not, will judge whether discard_unit is SECTION,
when f2fs_sb_has_blkzoned.
In fact, when CONFIG_BLK_DEV_ZONED is not enabled, this judgment
is a path that will never be accessed. At this time, -EINVAL will
be returned in the parse_options function, accompanied by the
message "Zoned block device support is not enabled".
Let's wrap this discard_unit judgment with CONFIG_BLK_DEV_ZONED.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 87d56a9883e6..1d057a4c6642 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1294,19 +1294,18 @@ default_check: * zone alignment optimization. This is optional for host-aware * devices, but mandatory for host-managed zoned block devices. */ -#ifndef CONFIG_BLK_DEV_ZONED - if (f2fs_sb_has_blkzoned(sbi)) { - f2fs_err(sbi, "Zoned block device support is not enabled"); - return -EINVAL; - } -#endif if (f2fs_sb_has_blkzoned(sbi)) { +#ifdef CONFIG_BLK_DEV_ZONED if (F2FS_OPTION(sbi).discard_unit != DISCARD_UNIT_SECTION) { f2fs_info(sbi, "Zoned block device doesn't need small discard, set discard_unit=section by default"); F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SECTION; } +#else + f2fs_err(sbi, "Zoned block device support is not enabled"); + return -EINVAL; +#endif } #ifdef CONFIG_F2FS_FS_COMPRESSION |