linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Sheng Yong <shengyong2021@gmail.com>, jaegeuk@kernel.org
Cc: shengyong1@xiaomi.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [RFC PATCH v2 02/32] f2fs-tools: add option N to answer no for all questions
Date: Wed, 11 Jun 2025 17:22:38 +0800	[thread overview]
Message-ID: <0d34ad8f-7cf7-4a7a-96b6-d7d6d9e5470c@kernel.org> (raw)
In-Reply-To: <20250610123743.667183-3-shengyong1@xiaomi.com>

On 6/10/25 20:37, Sheng Yong wrote:
> From: Sheng Yong <shengyong1@xiaomi.com>
> 
> In some scenario, such as autotest, it is not expected to answer
> question from fsck or dump. To simply answer no to all these questions,
> this patch adds an option `N' to do that.
> 
> Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
> ---
>  fsck/dump.c       |  3 +++
>  fsck/fsck.c       |  2 +-
>  fsck/main.c       | 14 +++++++++++---
>  include/f2fs_fs.h |  1 +
>  4 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/fsck/dump.c b/fsck/dump.c
> index 66d6c791ae09..10df7e593bfe 100644
> --- a/fsck/dump.c
> +++ b/fsck/dump.c
> @@ -681,6 +681,9 @@ static int dump_filesystem(struct f2fs_sb_info *sbi, struct node_info *ni,
>  	if (c.show_file_map)
>  		return dump_inode_blk(sbi, ni->ino, node_blk);
>  
> +	if (c.answer_no)
> +		return 0;
> +
>  	printf("Do you want to dump this %s into %s/? [Y/N] ",
>  			S_ISDIR(imode) ? "folder" : "file",
>  			base_path);
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index 4d05e1b4a21b..14677128dc2d 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -3834,7 +3834,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
>  	}
>  
>  #ifndef WITH_ANDROID
> -	if (nr_unref_nid && !c.ro) {
> +	if (nr_unref_nid && !c.ro && !c.answer_no) {
>  		char ans[255] = {0};
>  		int res;
>  
> diff --git a/fsck/main.c b/fsck/main.c
> index c5d41597934a..b01a22c8cf53 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -86,6 +86,7 @@ void fsck_usage()
>  	MSG(0, "  -t show directory tree\n");
>  	MSG(0, "  -q preserve quota limits\n");
>  	MSG(0, "  -y fix all the time\n");
> +	MSG(0, "  -N answer \"No\" for all questions\n");
>  	MSG(0, "  -V print the version number and exit\n");
>  	MSG(0, "  --dry-run do not really fix corruptions\n");
>  	MSG(0, "  --no-kernel-check skips detecting kernel change\n");
> @@ -114,6 +115,7 @@ void dump_usage()
>  	MSG(0, "  -f do not prompt before dumping\n");
>  	MSG(0, "  -H support write hint\n");
>  	MSG(0, "  -y alias for -f\n");
> +	MSG(0, "  -N answer \"No\" for all questions\n");
>  	MSG(0, "  -o dump inodes to the given path\n");
>  	MSG(0, "  -P preserve mode/owner/group for dumped inode\n");
>  	MSG(0, "  -L Preserves symlinks. Otherwise symlinks are dumped as regular files.\n");

It needs to update manual of fsck.f2fs and dump.f2fs as well?

Thanks,

> @@ -263,7 +265,7 @@ void f2fs_parse_options(int argc, char *argv[])
>  	}
>  
>  	if (!strcmp("fsck.f2fs", prog)) {
> -		const char *option_string = ":aC:c:m:Md:fg:HlO:p:q:StyV";
> +		const char *option_string = ":aC:c:m:Md:fg:HlO:p:q:StyNV";
>  		int opt = 0, val;
>  		char *token;
>  		struct option long_opt[] = {
> @@ -396,6 +398,9 @@ void f2fs_parse_options(int argc, char *argv[])
>  				c.force = 1;
>  				MSG(0, "Info: Force to fix corruption\n");
>  				break;
> +			case 'N':
> +				c.answer_no = true;
> +				break;
>  			case 'q':
>  				c.preserve_limits = atoi(optarg);
>  				MSG(0, "Info: Preserve quota limits = %d\n",
> @@ -449,7 +454,7 @@ void f2fs_parse_options(int argc, char *argv[])
>  		}
>  	} else if (!strcmp("dump.f2fs", prog)) {
>  #ifdef WITH_DUMP
> -		const char *option_string = "d:fi:I:n:LMo:Prs:Sa:b:Vy";
> +		const char *option_string = "d:fi:I:n:LMo:Prs:Sa:b:VyN";
>  		static struct dump_option dump_opt = {
>  			.nid = 0,	/* default root ino */
>  			.start_nat = -1,
> @@ -527,6 +532,9 @@ void f2fs_parse_options(int argc, char *argv[])
>  			case 'f':
>  				c.force = 1;
>  				break;
> +			case 'N':
> +				c.answer_no = true;
> +				break;
>  			case 'r':
>  				dump_opt.use_root_nid = 1;
>  				break;
> @@ -1369,7 +1377,7 @@ fsck_again:
>  
>  	f2fs_do_umount(sbi);
>  
> -	if (c.func == FSCK && c.bug_on) {
> +	if (c.func == FSCK && c.bug_on && !c.answer_no) {
>  		if (!c.ro && c.fix_on == 0 && c.auto_fix == 0 && !c.dry_run) {
>  			char ans[255] = {0};
>  retry:
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index f7268d1e90ff..5cd4ad666c06 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -1593,6 +1593,7 @@ struct f2fs_configuration {
>  	int whint;
>  	int aliased_devices;
>  	uint32_t aliased_segments;
> +	bool answer_no;
>  
>  	/* mkfs parameters */
>  	int fake_seed;



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2025-06-11  9:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 12:37 [f2fs-dev] [RFC PATCH v2 00/32] f2fs-tools: add testcases Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 01/32] fsck.f2fs: do not finish/reset zone if dry-run is true Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 02/32] f2fs-tools: add option N to answer no for all questions Sheng Yong
2025-06-11  9:22   ` Chao Yu via Linux-f2fs-devel [this message]
2025-06-11  9:36     ` Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 03/32] f2fs-tools: cleanup {nid|segno}_in_journal Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 04/32] fsck.f2fs: fix invalidate checkpoint Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 05/32] dump.f2fs: print more info Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 06/32] f2fs-tools: add and export lookup_sit_in_journal Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 07/32] inject.f2fs: fix injecting sit/nat in journal Sheng Yong
2025-06-11 11:42   ` Chao Yu via Linux-f2fs-devel
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 08/32] inject.f2fs: fix injection on zoned device Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 09/32] inject.f2fs: fix and cleanup parsing numeric options Sheng Yong
2025-06-13  6:08   ` Chao Yu via Linux-f2fs-devel
2025-06-16  1:49     ` Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 10/32] inject.f2fs: add members in inject_cp Sheng Yong
2025-06-13  7:30   ` Chao Yu via Linux-f2fs-devel
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 11/32] inject.f2fs: add member `feature' in inject_sb Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 12/32] inject.f2fs: add members in inject_node Sheng Yong
2025-06-13  7:38   ` Chao Yu via Linux-f2fs-devel
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 13/32] inject.f2fs: add member `filename' in inject_dentry Sheng Yong
2025-06-13  7:55   ` Chao Yu via Linux-f2fs-devel
2025-06-16  2:01     ` Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 14/32] tests: prepare helper scripts for testcases Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 15/32] tests: add fsck testcase of fixing bad super magic Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 16/32] tests: add fsck testcase of fixing errors recorded in sb Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 17/32] tests: add fsck testcase of fixing cp crc Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 18/32] tests: add fsck testcase of fixing nat entry with invalid ino Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 19/32] tests: add fsck testcase of fixing nat entry with invalid blkaddr Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 20/32] tests: add fsck testcase of fixing sit entry type Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 21/32] tests: add fsck testcase of fixing sit entry vblocks Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 22/32] tests: add fsck testcase of fixing sit entry valid_map Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 23/32] tests: add fsck testcase of fixing sum entry nid Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 24/32] tests: add fsck testcase of fixing sum footer type Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 25/32] tests: add fsck testcase of fixing sum entry ofs_in_node Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 26/32] tests: add fsck testcase of fixing inode invalid i_addr Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 27/32] tests: add fsck testcase of fixing dentry hash code Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 28/32] tests: add fsck testcase of fixing lost dots Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 29/32] tests: add fsck testcase of fixing duplicated dots Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 30/32] tests: add fsck testcase of fixing loop fsync dnodes Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 31/32] tests: add inject testcase of injecting META area Sheng Yong
2025-06-10 12:37 ` [f2fs-dev] [RFC PATCH v2 32/32] tests: add inject testcase of injecting node block Sheng Yong
2025-08-15 10:38 ` [f2fs-dev] [RFC PATCH v2 00/32] f2fs-tools: add testcases Chao Yu via Linux-f2fs-devel
2025-08-15 11:27   ` Sheng Yong
2025-08-16  7:04     ` Chao Yu via Linux-f2fs-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d34ad8f-7cf7-4a7a-96b6-d7d6d9e5470c@kernel.org \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=shengyong1@xiaomi.com \
    --cc=shengyong2021@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).