Skip to contentSkip to conversation

f2fs: Only lfs mode is allowed with zoned block device feature

PATCH Superseded Chunhai Guo via Linux-f2fs-devel 2 participants 4 messages Jun 20, 2023 – Aug 3, 2023 F2FS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: Only lfs mode is allowed with zoned block device feature

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
 fs/f2fs/super.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
fs/f2fs/super.c +7 -5
index c917fa771f0e..6249483be905 100644
@@ -861,12 +861,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 
 			if (!name)
 				return -ENOMEM;
+
+			if (strcmp(name, "lfs") && f2fs_sb_has_blkzoned(sbi)) {
+				f2fs_warn(sbi, "Only lfs mode is allowed with zoned block device feature");
+				kfree(name);
+				return -EINVAL;
+			}
+
 			if (!strcmp(name, "adaptive")) {
-				if (f2fs_sb_has_blkzoned(sbi)) {
-					f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature");
-					kfree(name);
-					return -EINVAL;
-				}
 				F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
 			} else if (!strcmp(name, "lfs")) {
 				F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;
Signature · 8 lines
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw

Hi Chao & Jaegeuk,

Could you please help to review this patch?

Thanks.

Quoted 23 lines · 郭纯海

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
  fs/f2fs/super.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
fs/f2fs/super.c +6 -0
index c917fa771f0e..6249483be905 100644
@@ -861,12 +861,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 
  			if (!name)
  				return -ENOMEM;
+
+			if (strcmp(name, "lfs") && f2fs_sb_has_blkzoned(sbi)) {
+				f2fs_warn(sbi, "Only lfs mode is allowed with zoned block device feature");
+				kfree(name);
+				return -EINVAL;
+			}

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 874

Quoted 10 lines
fs/f2fs/super.c +1 -5
+
  			if (!strcmp(name, "adaptive")) {
-				if (f2fs_sb_has_blkzoned(sbi)) {
-					f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature");
-					kfree(name);
-					return -EINVAL;
-				}
  				F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
  			} else if (!strcmp(name, "lfs")) {
  				F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#2 lore raw
In reply to Chunhai Guo via Linux-f2fs-devel
Quoted 14 lines · Chunhai Guo

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
  fs/f2fs/super.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
fs/f2fs/super.c +0 -0
index c917fa771f0e..6249483be905 100644

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 869

Quoted 9 lines
fs/f2fs/super.c +6 -0
@@ -861,12 +861,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 
  			if (!name)
  				return -ENOMEM;
+
+			if (strcmp(name, "lfs") && f2fs_sb_has_blkzoned(sbi)) {
+				f2fs_warn(sbi, "Only lfs mode is allowed with zoned block device feature");
+				kfree(name);
+				return -EINVAL;
+			}

What about:

From f6e71f1d33c2cca543ebb41734c7a95af5190767 Mon Sep 17 00:00:00 2001
From: Chunhai Guo <[email protected]>
Date: Sun, 30 Jul 2023 10:06:50 +0800
Subject: [PATCH] f2fs: only lfs mode is allowed with zoned block device
feature

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
 fs/f2fs/super.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/f2fs/super.c +4 -5
index 099e126c61e1..1d0593358125 100644
@@ -864,11 +864,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			if (!name)
 				return -ENOMEM;
 			if (!strcmp(name, "adaptive")) {
-				if (f2fs_sb_has_blkzoned(sbi)) {
-					f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature");
-					kfree(name);
-					return -EINVAL;
-				}
 				F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
 			} else if (!strcmp(name, "lfs")) {
 				F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;
@@ -1333,6 +1328,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 			F2FS_OPTION(sbi).discard_unit =
 					DISCARD_UNIT_SECTION;
 		}
+		if (F2FS_OPTION(sbi).fs_mode != FS_MODE_LFS) {
+			f2fs_info(sbi, "Only lfs mode is allowed with zoned block device feature");
+			return -EINVAL;
+		}
 #else
 		f2fs_err(sbi, "Zoned block device support is not enabled");
 		return -EINVAL;
Signature · 1 line
2.40.1

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 874

Quoted 10 lines
fs/f2fs/super.c +1 -5
+
  			if (!strcmp(name, "adaptive")) {
-				if (f2fs_sb_has_blkzoned(sbi)) {
-					f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature");
-					kfree(name);
-					return -EINVAL;
-				}
  				F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
  			} else if (!strcmp(name, "lfs")) {
  				F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw

Hi Chao,

I have sent the second patch with your suggestion. Please have a check.

Thanks.

Quoted 59 lines · Chao Yu
Quoted 14 lines · Chunhai Guo

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
   fs/f2fs/super.c | 12 +++++++-----
   1 file changed, 7 insertions(+), 5 deletions(-)
fs/f2fs/super.c +0 -0
index c917fa771f0e..6249483be905 100644

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 869

Quoted 9 lines
fs/f2fs/super.c +6 -0
@@ -861,12 +861,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
 
   			if (!name)
   				return -ENOMEM;
+
+			if (strcmp(name, "lfs") && f2fs_sb_has_blkzoned(sbi)) {
+				f2fs_warn(sbi, "Only lfs mode is allowed with zoned block device feature");
+				kfree(name);
+				return -EINVAL;
+			}

What about:

From f6e71f1d33c2cca543ebb41734c7a95af5190767 Mon Sep 17 00:00:00 2001
From: Chunhai Guo <[email protected]>
Date: Sun, 30 Jul 2023 10:06:50 +0800
Subject: [PATCH] f2fs: only lfs mode is allowed with zoned block device
feature

Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.

---
   fs/f2fs/super.c | 9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)
fs/f2fs/super.c +0 -5
index 099e126c61e1..1d0593358125 100644
@@ -864,11 +864,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
   			if (!name)
   				return -ENOMEM;
   			if (!strcmp(name, "adaptive")) {
-				if (f2fs_sb_has_blkzoned(sbi)) {
-					f2fs_warn(sbi, "adaptive mode is not allowed with zoned block device feature");
-					kfree(name);
-					return -EINVAL;
-				}
   				F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
   			} else if (!strcmp(name, "lfs")) {
   				F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;

fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount) · line 1337

Quoted 10 lines
fs/f2fs/super.c +4 -0
@@ -1333,6 +1328,10 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
   			F2FS_OPTION(sbi).discard_unit =
   					DISCARD_UNIT_SECTION;
   		}
+		if (F2FS_OPTION(sbi).fs_mode != FS_MODE_LFS) {
+			f2fs_info(sbi, "Only lfs mode is allowed with zoned block device feature");
+			return -EINVAL;
+		}
   #else
   		f2fs_err(sbi, "Zoned block device support is not enabled");
   		return -EINVAL;

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel