2022-10-27 13:10:39

by 李扬韬

[permalink] [raw]
Subject: [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().

Signed-off-by: Yangtao Li <[email protected]>
---
fs/f2fs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a241e4073f1d..fc220b5c5599 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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);
--
2.25.1



2022-10-27 13:33:16

by Chao Yu

[permalink] [raw]
Subject: Re: [PATCH 1/3] f2fs: rename flush_error_work() to f2fs_record_error_work()

On 2022/10/27 20:08, Yangtao Li wrote:
> 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().

It won't pollute global namespace since it's a static function just be
used in f2fs/super.c...

>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> fs/f2fs/super.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index a241e4073f1d..fc220b5c5599 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -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);