From: Chao Yu <chao@kernel.org>
To: Yangtao Li <frank.li@vivo.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1
Date: Tue, 25 Oct 2022 11:03:09 +0800 [thread overview]
Message-ID: <5f0e2e43-1167-7fb7-9dc6-02ed0fc1858b@kernel.org> (raw)
In-Reply-To: <20221021174633.12541-1-frank.li@vivo.com>
On 2022/10/22 1:46, Yangtao Li wrote:
> Under the current logic, when gc_urgent_high_remaining is set to 1,
> the mode will be switched to normal at the beginning, instead of
> running in gc_urgent mode.
>
> Let's switch the gc mode back to normal when the gc ends.
>
> Fixes: 265576181b4a ("f2fs: remove gc_urgent_high_limited for cleanup")
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/f2fs/gc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 4546e01b2ee0..2f113fbcb85c 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -45,6 +45,7 @@ static int gc_thread_func(void *data)
> set_freezable();
> do {
> bool sync_mode, foreground = false;
> + bool gc_normal_mode = false;
>
> wait_event_interruptible_timeout(*wq,
> kthread_should_stop() || freezing(current) ||
> @@ -101,7 +102,7 @@ static int gc_thread_func(void *data)
> if (sbi->gc_urgent_high_remaining) {
> sbi->gc_urgent_high_remaining--;
> if (!sbi->gc_urgent_high_remaining)
> - sbi->gc_mode = GC_NORMAL;
> + gc_normal_mode = true;
> }
> spin_unlock(&sbi->gc_urgent_high_lock);
So, can we move above logic to the end of loop?
> }
> @@ -162,6 +163,10 @@ static int gc_thread_func(void *data)
> /* balancing f2fs's metadata periodically */
> f2fs_balance_fs_bg(sbi, true);
> next:
> + if (gc_normal_mode) {
> + sbi->gc_mode = GC_NORMAL;
> + gc_normal_mode = false;
> + }
> sb_end_write(sbi->sb);
>
> } while (!kthread_should_stop());
prev parent reply other threads:[~2022-10-25 3:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 17:46 [PATCH 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1 Yangtao Li
2022-10-21 17:46 ` [PATCH 2/2] f2fs: introducr gc_urgent_idle_remaining sysfs node and mark gc_urgent_high_remaining node deprecated Yangtao Li
2022-10-25 3:03 ` Chao Yu [this message]
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=5f0e2e43-1167-7fb7-9dc6-02ed0fc1858b@kernel.org \
--to=chao@kernel.org \
--cc=frank.li@vivo.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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).