From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Weichao Guo <guoweichao@msn.com>
Cc: zhangshiming@oppo.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling
Date: Fri, 6 May 2022 16:38:23 -0700 [thread overview]
Message-ID: <YnWxb8LXlsRNN3GK@google.com> (raw)
In-Reply-To: <DM5PR17MB0953D6D7C81E3F4B54DF1006C6C59@DM5PR17MB0953.namprd17.prod.outlook.com>
On 05/07, Weichao Guo wrote:
> From: Weichao Guo <guoweichao@oppo.com>
>
> If the number of unusable blocks is not larger than
> unusable capacity, we can skip GC when checkpoint
> disabling.
I modified to fix restoring gc_mode back by the below.
- unsigned int gc_mode;
+ unsigned int gc_mode = sbi->gc_mode;
>
> Signed-off-by: Weichao Guo <guoweichao@oppo.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/super.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index d06a577..7edb018 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2069,6 +2069,11 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
> }
> sbi->sb->s_flags |= SB_ACTIVE;
>
> + /* check if we need more GC first */
> + unusable = f2fs_get_unusable_blocks(sbi);
> + if (!f2fs_disable_cp_again(sbi, unusable))
> + goto skip_gc;
> +
> f2fs_update_time(sbi, DISABLE_TIME);
>
> gc_mode = sbi->gc_mode;
> @@ -2097,6 +2102,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
> goto restore_flag;
> }
>
> +skip_gc:
> f2fs_down_write(&sbi->gc_lock);
> cpc.reason = CP_PAUSE;
> set_sbi_flag(sbi, SBI_CP_DISABLED);
> --
> 1.9.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-05-06 23:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 16:28 [f2fs-dev] [PATCH] f2fs: skip GC if possible when checkpoint disabling Weichao Guo
2022-05-06 23:38 ` Jaegeuk Kim [this message]
2022-05-07 3:38 ` Chao Yu
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=YnWxb8LXlsRNN3GK@google.com \
--to=jaegeuk@kernel.org \
--cc=guoweichao@msn.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=zhangshiming@oppo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.