f2fs: rename flush_error_work() to f2fs_record_error_work()
PATCH 1/3 f2fs: rename flush_error_work() to f2fs_record_error_work()
Since it is an f2fs module, it is best to prefix function names with f2fs_. At the same time, there is already a flush thread and related functions in the system, rename flush_error_work() to f2fs_record_error_work().
--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/super.c +2 -2
@@ -4019,7 +4019,7 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,f2fs_stop_discard_thread (sbi); } -static void flush_error_work (struct work_struct *work) +static void f2fs_record_error_work (struct work_struct *work) {struct f2fs_sb_info *sbi =container_of (work, struct f2fs_sb_info, s_error_work);
@@ -4374,7 +4374,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_devices; } -INIT_WORK (&sbi->s_error_work, flush_error_work); +INIT_WORK (&sbi->s_error_work, f2fs_record_error_work);spin_lock_init (&sbi->error_lock);memcpy (sbi->errors, raw_super->s_errors,MAX_F2FS_ERRORS );memcpy (sbi->stop_reason, raw_super->s_stop_reason,MAX_STOP_REASON );
Signature · 1 line
2.25.1
PATCH 2/3 f2fs: export f2fs_stop_flush_thread() for external use
Need to stop the flush thread running externally,
so export it.
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/segment.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +1 -0
@@ -3732,6 +3732,7 @@ unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi, unsigned int segno);unsigned int f2fs_usable_blks_in_seg (struct f2fs_sb_info *sbi,unsigned int segno); +void f2fs_stop_flush_thread (struct f2fs_sb_info *sbi);#define DEF_FRAGMENT_SIZE 4#define MIN_FRAGMENT_SIZE 1
fs/f2fs/segment.c +8 -1
@@ -671,7 +671,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)return 0 ; } -void f2fs_destroy_flush_cmd_control (struct f2fs_sb_info *sbi,bool free) +void f2fs_stop_flush_thread (struct f2fs_sb_info *sbi) {struct flush_cmd_control *fcc =SM_I (sbi)->fcc_info;
@@ -681,6 +681,13 @@ void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free) fcc->f2fs_issue_flush =NULL ;kthread_stop (flush_thread); } +} + +void f2fs_destroy_flush_cmd_control (struct f2fs_sb_info *sbi,bool free) +{ +struct flush_cmd_control *fcc =SM_I (sbi)->fcc_info; + +f2fs_stop_flush_thread (sbi);if (free) {kfree (fcc);SM_I (sbi)->fcc_info =NULL ;
Signature · 1 line
2.25.1
PATCH 3/3 f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
In reply to Yangtao LiWhen a fatal error occurs in the file system and it is remounted to ro mode, the flush thread needs to be stopped.
--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/super.c +1 -0
@@ -4017,6 +4017,7 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,f2fs_stop_gc_thread (sbi);f2fs_stop_discard_thread (sbi); +f2fs_stop_flush_thread (sbi); }static void f2fs_record_error_work (struct work_struct *work)
Signature · 1 line
2.25.1
Chao Yu
maintainerRe: [PATCH 3/3] f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
Quoted 4 lines · Yangtao Li
When a fatal error occurs in the file system and it is remounted to ro mode, the flush thread needs to be stopped.
Fixes d81ab30e85a5 ("f2fs: support errors=remount-ro|continue|panic mountoption")
Do you mind letting me merge these two patches into original patch? since original patch is still in dev branch, rather than mainline.
I guess it needs to stop ckpt thread as well...
Thanks,
Quoted 17 lines
Signed-off-by Yangtao Li <[email protected]>--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)fs/f2fs/super.c +1
-0@@ -4017,6 +4017,7 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,f2fs_stop_gc_thread (sbi);f2fs_stop_discard_thread (sbi); +f2fs_stop_flush_thread (sbi); }static void f2fs_record_error_work (struct work_struct *work)
Re: [PATCH 3/3] f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
Quoted 1 line
It won't pollute global namespace since it's a static function just be used in
f2fs/super.c...
emm, I think it would be nice to see the f2fs_record_error_work symbol
in the stack, it can be explicitly a function of f2fs. personal opinion for reference only.
Quoted 2 lines
Do you mind letting me merge these two patches into original patch? since original patch is still in dev branch, rather than mainline.
Glad to see, if resend.
Quoted 1 line
I guess it needs to stop ckpt thread as well...
agree, :)
Thanks,
Chao Yu
maintainerRe: [PATCH 3/3] f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
Quoted 4 lines · Yangtao Li
Quoted 1 line
It won't pollute global namespace since it's a static function just be used in
f2fs/super.c...emm, I think it would be nice to see the
f2fs_record_error_worksymbol
in the stack, it can be explicitly a function of f2fs. personal opinion for reference only.
Oh, yes, let me update in original patch as well.
Quoted 5 lines
Quoted 3 lines
Do you mind letting me merge these two patches into original patch? since original patch is still in dev branch, rather than mainline.
Glad to see, if resend.
Thanks, :)
Quoted 6 lines
Quoted 2 lines
I guess it needs to stop ckpt thread as well...
agree, :)
Thanks,
Jaegeuk Kim
maintainerRe: [PATCH 3/3] f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
Quoted 7 lines · Chao Yu
Quoted 4 lines · Yangtao Li
Quoted 1 line
It won't pollute global namespace since it's a static function just be used in
f2fs/super.c...emm, I think it would be nice to see the
f2fs_record_error_worksymbol
in the stack, it can be explicitly a function of f2fs. personal opinion for reference only.Oh, yes, let me update in original patch as well.
Chao,
It seems there're multiple bugs. Please apply this as well.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u
Quoted 15 lines
Quoted 6 lines
Quoted 4 lines
Do you mind letting me merge these two patches into original patch? since original patch is still in dev branch, rather than mainline.
Glad to see, if resend.
Thanks, :)
Quoted 6 lines
Quoted 2 lines
I guess it needs to stop ckpt thread as well...
agree, :)
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerRe: [PATCH 3/3] f2fs: fix to f2fs_handle_critical_error when errors=remount-ro
Quoted 7 lines · Jaegeuk Kim
Quoted 6 lines · Chao Yu
Quoted 4 lines · Yangtao Li
Quoted 1 line
It won't pollute global namespace since it's a static function just be used in
f2fs/super.c...emm, I think it would be nice to see the
f2fs_record_error_worksymbol
in the stack, it can be explicitly a function of f2fs. personal opinion for reference only.
Quoted 7 lines
Quoted 1 line
Oh, yes, let me update in original patch as well.
Chao,
It seems there're multiple bugs. Please apply this as well.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u
Jaegeuk,
Thanks, let me merge all those patches and do the test.
Thanks,
Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
Quoted 5 lines
Do you mind letting me merge these two patches into original patch? since original patch is still in dev branch, rather than mainline.
Glad to see, if resend.
Thanks, :)
Quoted 6 lines
Quoted 2 lines
I guess it needs to stop ckpt thread as well...
agree, :)
Thanks,
Chao Yu
maintainerQuoted 4 lines · Yangtao Li
Since it is an f2fs module, it is best to prefix function names with
f2fs_. At the same time, there is already a flush thread and related functions in the system, renameflush_error_work()tof2fs_record_error_work().
It won't pollute global namespace since it's a static function just be used in f2fs/super.c...
Quoted 28 lines
Signed-off-by Yangtao Li <[email protected]>--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/f2fs/super.c +2
-2@@ -4019,7 +4019,7 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,f2fs_stop_discard_thread (sbi); } -static void flush_error_work (struct work_struct *work) +static void f2fs_record_error_work (struct work_struct *work) {struct f2fs_sb_info *sbi =container_of (work, struct f2fs_sb_info, s_error_work);@@ -4374,7 +4374,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_devices; } -INIT_WORK (&sbi->s_error_work, flush_error_work); +INIT_WORK (&sbi->s_error_work, f2fs_record_error_work);spin_lock_init (&sbi->error_lock);memcpy (sbi->errors, raw_super->s_errors,MAX_F2FS_ERRORS );memcpy (sbi->stop_reason, raw_super->s_stop_reason,MAX_STOP_REASON );