From: Hou Pengyang <houpengyang@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: guoweichao@huawei.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: avoid unnecessary fg_gc
Date: Mon, 27 Feb 2017 09:59:09 +0800 [thread overview]
Message-ID: <58B387ED.8080700@huawei.com> (raw)
In-Reply-To: <20170225193959.GE51627@jaegeuk.local>
On 2017/2/26 3:39, Jaegeuk Kim wrote:
> On 02/25, heyunlei wrote:
>> Hi all,
>>
>> I am really confused by the condition below use sec_freed, is it always equal to zero?
>
> Seems it is always zero. Let's fix it together.
>
> Pengyang,
>
> I merged your patches and finally got this.
> How do you think?
>
Seems OK to me :)
Thanks,
>>From d1c2206e4f245a8fedec3a8f21ad522b3b1b2d0c Mon Sep 17 00:00:00 2001
> From: Hou Pengyang <houpengyang@huawei.com>
> Date: Sat, 25 Feb 2017 03:57:38 +0000
> Subject: [PATCH] f2fs: avoid bggc->fggc when enough free segments are
> avaliable after cp
>
> We use has_not_enough_free_secs to check if there are enough free segments,
>
> (free_sections(sbi) + freed) <=
> (node_secs + 2 * dent_secs + imeta_secs +
> reserved_sections(sbi) + needed);
>
> Under scenario with large number of dirty nodes, these nodes would be flushed
> during cp, as a result, right side of the inequality would be decreased, while
> left side stays unchanged if these nodes are flushed in SSR way, which means
> there are enough free segments after this cp.
>
> For this case, we just do a bggc instead of fggc.
>
> Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/gc.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 1af17c5af603..471ed899f639 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -954,21 +954,22 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
> goto stop;
> }
>
> - if (gc_type == BG_GC && has_not_enough_free_secs(sbi, sec_freed, 0)) {
> - gc_type = FG_GC;
> + if (gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) {
> /*
> - * If there is no victim and no prefree segment but still not
> - * enough free sections, we should flush dent/node blocks and do
> - * garbage collections.
> + * For example, if there are many prefree_segments below given
> + * threshold, we can make them free by checkpoint. Then, we
> + * secure free segments which doesn't need fggc any more.
> */
> ret = write_checkpoint(sbi, &cpc);
> if (ret)
> goto stop;
> - } else if (gc_type == BG_GC && !background) {
> - /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
> - goto stop;
> + if (has_not_enough_free_secs(sbi, 0, 0))
> + gc_type = FG_GC;
> }
>
> + /* f2fs_balance_fs doesn't need to do BG_GC in critical path. */
> + if (gc_type == BG_GC && !background)
> + goto stop;
> if (!__get_victim(sbi, &segno, gc_type))
> goto stop;
> ret = 0;
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
next prev parent reply other threads:[~2017-02-27 1:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 10:01 [PATCH] f2fs: avoid unnecessary fg_gc Hou Pengyang
2017-02-24 10:28 ` Chao Yu
2017-02-25 1:44 ` Hou Pengyang
2017-02-25 2:07 ` Chao Yu
2017-02-25 2:07 ` Jaegeuk Kim
2017-02-25 2:23 ` heyunlei
2017-02-25 19:39 ` Jaegeuk Kim
2017-02-27 1:59 ` Hou Pengyang [this message]
2017-02-27 2:28 ` heyunlei
2017-02-27 23:40 ` Jaegeuk Kim
2017-02-28 2:06 ` heyunlei
2017-02-27 6:25 ` Chao Yu
2017-02-25 2:54 ` Hou Pengyang
2017-02-25 3:57 ` [PATCH 1/2] remove stale comment info about cp before fggc Hou Pengyang
2017-02-25 3:57 ` [PATCH 2/2] f2fs: avoid bggc->fggc when enough free segments are avaliable after cp Hou Pengyang
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=58B387ED.8080700@huawei.com \
--to=houpengyang@huawei.com \
--cc=guoweichao@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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.