* [f2fs-dev] [PATCH] f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED
@ 2022-11-29 12:29 Yangtao Li via Linux-f2fs-devel
2023-01-11 13:03 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2022-11-29 12:29 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel
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>
---
fs/f2fs/super.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 79bf1faf4161..753c97be7d39 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1289,19 +1289,18 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
* 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
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED
2022-11-29 12:29 [f2fs-dev] [PATCH] f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED Yangtao Li via Linux-f2fs-devel
@ 2023-01-11 13:03 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2023-01-11 13:03 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2022/11/29 20:29, Yangtao Li wrote:
> 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>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-11 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 12:29 [f2fs-dev] [PATCH] f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED Yangtao Li via Linux-f2fs-devel
2023-01-11 13:03 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).