f2fs: add errors=panic mount option
PATCH 1/1 f2fs: add errors=panic mount option
Add errors=panic mount option for debugging purpose. It can be set dynamically when the config option CONFIG_F2FS_CHECK_FS is not enabled.
--- fs/f2fs/f2fs.h | 9 +++++++-- fs/f2fs/super.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)
fs/f2fs/f2fs.h +7 -2
@@ -32,8 +32,12 @@#define f2fs_bug_on (sbi, condition) \ do { \ if (unlikely(condition)) { \ - WARN_ON(1); \ - set_sbi_flag(sbi, SBI_NEED_FSCK); \ + if (test_opt(sbi, ERRORS_PANIC)) { \ + BUG_ON(condition); \ + } else { \ + WARN_ON(1); \ + set_sbi_flag(sbi, SBI_NEED_FSCK); \ + } \ } \ } while (0)#endif
@@ -99,6 +103,7 @@ struct f2fs_fault_info {#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000#define F2FS_MOUNT_RESERVE_ROOT 0x01000000#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 +#define F2FS_MOUNT_ERRORS_PANIC 0x04000000#define F2FS_OPTION (sbi) ((sbi)->mount_opt)#define clear_opt (sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
fs/f2fs/super.c +21 -0
@@ -137,6 +137,7 @@ enum { Opt_fsync, Opt_test_dummy_encryption, Opt_checkpoint, + Opt_errors, Opt_err, };
@@ -196,6 +197,7 @@ enum { {Opt_fsync, "fsync_mode=%s"}, {Opt_test_dummy_encryption, "test_dummy_encryption"}, {Opt_checkpoint, "checkpoint=%s"}, + {Opt_errors, "errors=%s"}, {Opt_err, NULL}, };
@@ -788,6 +790,23 @@ static int parse_options(struct super_block *sb, char *options) }kvfree (name);break ; +case Opt_errors: +#ifndef CONFIG_F2FS_CHECK_FS + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + +if (strlen (name) ==5 && !strncmp (name,"panic" ,5 )) { +set_opt (sbi,ERRORS_PANIC ); + }else { +kvfree (name); +return -EINVAL ; + } +kvfree (name); +f2fs_msg (sb,KERN_INFO , +"debug mode errors=panic enabled\n" ); +#endif +break ;default : f2fs_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" or missing value",
@@ -1417,6 +1436,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsync_mode=%s" ,"strict" ); else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) seq_printf(seq, ",fsync_mode=%s", "nobarrier"); +if (test_opt (sbi,ERRORS_PANIC )) +seq_printf (seq,",errors=%s" ,"panic" );return 0 ; }
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Chao Yu
maintainerQuoted 3 lines · Sahitya Tummala
Add errors=panic mount option for debugging purpose. It can be set dynamically when the config option
CONFIG_F2FS_CHECK_FSis not enabled.
Sahitya,
I remember Yunlei has a similar patch for this, could you rebase your code on that patch, if Yunlei agrees, we can add Signed-off of him.
FYI
Thanks,
Quoted 88 lines
Signed-off-by Sahitya Tummala <[email protected]>--- fs/f2fs/f2fs.h | 9 +++++++-- fs/f2fs/super.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)fs/f2fs/f2fs.h +7
-2@@ -32,8 +32,12 @@#define f2fs_bug_on (sbi, condition) \ do { \ if (unlikely(condition)) { \ - WARN_ON(1); \ - set_sbi_flag(sbi, SBI_NEED_FSCK); \ + if (test_opt(sbi, ERRORS_PANIC)) { \ + BUG_ON(condition); \ + } else { \ + WARN_ON(1); \ + set_sbi_flag(sbi, SBI_NEED_FSCK); \ + } \ } \ } while (0)#endif @@ -99,6 +103,7 @@ struct f2fs_fault_info {#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000#define F2FS_MOUNT_RESERVE_ROOT 0x01000000#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 +#define F2FS_MOUNT_ERRORS_PANIC 0x04000000#define F2FS_OPTION (sbi) ((sbi)->mount_opt)#define clear_opt (sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)fs/f2fs/super.c +21
-0@@ -137,6 +137,7 @@ enum { Opt_fsync, Opt_test_dummy_encryption, Opt_checkpoint, + Opt_errors, Opt_err, };@@ -196,6 +197,7 @@ enum { {Opt_fsync, "fsync_mode=%s"}, {Opt_test_dummy_encryption, "test_dummy_encryption"}, {Opt_checkpoint, "checkpoint=%s"}, + {Opt_errors, "errors=%s"}, {Opt_err, NULL}, };@@ -788,6 +790,23 @@ static int parse_options(struct super_block *sb, char *options) }kvfree (name);break ; +case Opt_errors: +#ifndef CONFIG_F2FS_CHECK_FS + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + +if (strlen (name) ==5 && !strncmp (name,"panic" ,5 )) { +set_opt (sbi,ERRORS_PANIC ); + }else { +kvfree (name); +return -EINVAL ; + } +kvfree (name); +f2fs_msg (sb,KERN_INFO , +"debug mode errors=panic enabled\n" ); +#endif +break ;default : f2fs_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" or missing value",@@ -1417,6 +1436,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsync_mode=%s" ,"strict" ); else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) seq_printf(seq, ",fsync_mode=%s", "nobarrier"); +if (test_opt (sbi,ERRORS_PANIC )) +seq_printf (seq,",errors=%s" ,"panic" );return 0 ; }
Quoted 10 lines · Chao Yu
Quoted 3 lines · Sahitya Tummala
Add errors=panic mount option for debugging purpose. It can be set dynamically when the config option
CONFIG_F2FS_CHECK_FSis not enabled.Sahitya,
I remember Yunlei has a similar patch for this, could you rebase your code on that patch, if Yunlei agrees, we can add Signed-off of him.
Hi Chao,
Sure, I can combine both the patches as they are providing different functionalities with the same mount option.
Hi Yunlei,
Are you okay with this merging? Please confirm.
If yes, then I will make it into one patch and add your signed-off.
Thanks,
Quoted 94 lines
FYI
Thanks,
Quoted 88 lines
Signed-off-by Sahitya Tummala <[email protected]>--- fs/f2fs/f2fs.h | 9 +++++++-- fs/f2fs/super.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)fs/f2fs/f2fs.h +7
-2@@ -32,8 +32,12 @@#define f2fs_bug_on (sbi, condition) \ do { \ if (unlikely(condition)) { \ - WARN_ON(1); \ - set_sbi_flag(sbi, SBI_NEED_FSCK); \ + if (test_opt(sbi, ERRORS_PANIC)) { \ + BUG_ON(condition); \ + } else { \ + WARN_ON(1); \ + set_sbi_flag(sbi, SBI_NEED_FSCK); \ + } \ } \ } while (0)#endif @@ -99,6 +103,7 @@ struct f2fs_fault_info {#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000#define F2FS_MOUNT_RESERVE_ROOT 0x01000000#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 +#define F2FS_MOUNT_ERRORS_PANIC 0x04000000#define F2FS_OPTION (sbi) ((sbi)->mount_opt)#define clear_opt (sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)fs/f2fs/super.c +21
-0@@ -137,6 +137,7 @@ enum { Opt_fsync, Opt_test_dummy_encryption, Opt_checkpoint, + Opt_errors, Opt_err, };@@ -196,6 +197,7 @@ enum { {Opt_fsync, "fsync_mode=%s"}, {Opt_test_dummy_encryption, "test_dummy_encryption"}, {Opt_checkpoint, "checkpoint=%s"}, + {Opt_errors, "errors=%s"}, {Opt_err, NULL}, };@@ -788,6 +790,23 @@ static int parse_options(struct super_block *sb, char *options) }kvfree (name);break ; +case Opt_errors: +#ifndef CONFIG_F2FS_CHECK_FS + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + +if (strlen (name) ==5 && !strncmp (name,"panic" ,5 )) { +set_opt (sbi,ERRORS_PANIC ); + }else { +kvfree (name); +return -EINVAL ; + } +kvfree (name); +f2fs_msg (sb,KERN_INFO , +"debug mode errors=panic enabled\n" ); +#endif +break ;default : f2fs_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" or missing value",@@ -1417,6 +1436,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)seq_printf (seq,",fsync_mode=%s" ,"strict" ); else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_NOBARRIER) seq_printf(seq, ",fsync_mode=%s", "nobarrier"); +if (test_opt (sbi,ERRORS_PANIC )) +seq_printf (seq,",errors=%s" ,"panic" );return 0 ; }
Signature · 3 lines
-- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.