Skip to contentSkip to conversation

resize.f2fs: add -g to give default options

PATCH Superseded Yangyang Zang 3 participants 3 messages Nov 24, 2025 – Nov 25, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 resize.f2fs: add -g to give default options

Commit 42482e81248f ("resize.f2fs: add caution message for resize") introduced the -F' option to force resizing f2fs without displaying the caution message. And add_default_options() implies that -g' enables -F' for resize by default. However resize.f2fs does not currently support the -g' option. This patch adds `-g' for it.

Fixes 42482e81248f ("resize.f2fs: add caution message for resize")

---
Changes in v2:
- Modify the commit message as suggested by shengyong

---
 fsck/main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +10 -1
index f7ef092..08d38d8 100644
@@ -145,6 +145,9 @@ void resize_usage()
 	MSG(0, "[options]:\n");
 	MSG(0, "  -d debug level [default:0]\n");
 	MSG(0, "  -H support write hint\n");
+	MSG(0, "  -f ignore errors during resize\n");
+	MSG(0, "  -F force to resize\n");
+	MSG(0, "  -g add default options\n");
 	MSG(0, "  -o overprovision percentage [default:auto]\n");
 	MSG(0, "  -s safe resize (Does not resize metadata)\n");
 	MSG(0, "  -t target sectors [default: device size]\n");
@@ -640,7 +643,7 @@ void f2fs_parse_options(int argc, char *argv[])
 #endif
 	} else if (!strcmp("resize.f2fs", prog)) {
 #ifdef WITH_RESIZE
-		const char *option_string = "d:fFHst:o:V";
+		const char *option_string = "d:fFg:Hst:o:V";
 
 		c.func = RESIZE;
 		while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -664,6 +667,12 @@ void f2fs_parse_options(int argc, char *argv[])
 				c.force = 1;
 				MSG(0, "Info: Force to resize\n");
 				break;
+                        case 'g':
+                                if (!strcmp(optarg, "android")) {
+                                        c.defset = CONF_ANDROID;
+                                        MSG(0, "Info: Set conf for android\n");
+                                }
+                                break;
 			case 'H':
 				c.need_whint = true;
 				c.whint = WRITE_LIFE_NOT_SET;
Signature · 8 lines
2.43.2



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Yangyang Zang

Commit 42482e81248f ("resize.f2fs: add caution message for resize") introduced the -F' option to force resizing f2fs without displaying the caution message. And add_default_options() implies that -g' enables -F' for resize by default. However resize.f2fs does not currently support the -g' option. This patch adds `-g' for it.

Fixes 42482e81248f ("resize.f2fs: add caution message for resize")

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

#2 lore raw
In reply to Yangyang Zang
Quoted 20 lines · Yangyang Zang

Commit 42482e81248f ("resize.f2fs: add caution message for resize") introduced the -F' option to force resizing f2fs without displaying the caution message. And add_default_options() implies that -g' enables -F' for resize by default. However resize.f2fs does not currently support the -g' option. This patch adds `-g' for it.

Fixes 42482e81248f ("resize.f2fs: add caution message for resize")

---
Changes in v2:
- Modify the commit message as suggested by shengyong

---
  fsck/main.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +0 -0
index f7ef092..08d38d8 100644

fsck/main.c void resize_usage() · line 150

Quoted 6 lines
fsck/main.c +3 -0
@@ -145,6 +145,9 @@ void resize_usage()
  	MSG(0, "[options]:\n");
  	MSG(0, "  -d debug level [default:0]\n");
  	MSG(0, "  -H support write hint\n");
+	MSG(0, "  -f ignore errors during resize\n");
+	MSG(0, "  -F force to resize\n");
+	MSG(0, "  -g add default options\n");

Need to update manual page of resize.f2fs as well?

Thanks,

Quoted 15 lines
fsck/main.c +1 -1
  	MSG(0, "  -o overprovision percentage [default:auto]\n");
  	MSG(0, "  -s safe resize (Does not resize metadata)\n");
  	MSG(0, "  -t target sectors [default: device size]\n");
@@ -640,7 +643,7 @@ void f2fs_parse_options(int argc, char *argv[])
  #endif
  	} else if (!strcmp("resize.f2fs", prog)) {
  #ifdef WITH_RESIZE
-		const char *option_string = "d:fFHst:o:V";
+		const char *option_string = "d:fFg:Hst:o:V";
 
  		c.func = RESIZE;
  		while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -664,6 +667,12 @@ void f2fs_parse_options(int argc, char *argv[])
  				c.force = 1;
  				MSG(0, "Info: Force to resize\n");

fsck/main.c void f2fs_parse_options(int argc, char *argv[]) · line 678

Quoted 10 lines
fsck/main.c +6 -0
  				break;
+                        case 'g':
+                                if (!strcmp(optarg, "android")) {
+                                        c.defset = CONF_ANDROID;
+                                        MSG(0, "Info: Set conf for android\n");
+                                }
+                                break;
  			case 'H':
  				c.need_whint = true;
  				c.whint = WRITE_LIFE_NOT_SET;

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