All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Weichao Guo <guoweichao@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: skip checkpoint if having a dirty segment but no prefree at BG_GC -> FG_GC
Date: Fri, 24 Feb 2017 10:49:59 -0800	[thread overview]
Message-ID: <20170224184959.GD39009@jaegeuk.local> (raw)
In-Reply-To: <20170224204357.220337-1-guoweichao@huawei.com>

Hi Weichao,

On 02/25, Weichao Guo wrote:
> When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
> * a) BG_GC have made some progress, e.g.: some prefree segments.
> * b) There is no victim and no prefree segment.

You missed
  * c) has_not_enough_free_secs() introduced by
      6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

And, Yunlong pointed that we can't find a case to avoid write_checkpoint()
mostly due to c) condition.

Thanks,

> 
> For case a), previously, we also check if there is a dirty segment for
> infering blocks moving in last BG_GC. But dirty segments do not always
> indicate that, BG_GC may just start and do not move any blocks at all.
> Futhermore, skipping checkpoint if there are some dirty segments but no
> prefree segments is OK.


> 
> Signed-off-by: Weichao Guo <guoweichao@huawei.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 6c996e3..30d206a 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
>  		 * enough free sections, we should flush dent/node blocks and do
>  		 * garbage collections.
>  		 */
> -		ret = write_checkpoint(sbi, &cpc);
> +		if (prefree_segments(sbi))
> +			ret = write_checkpoint(sbi, &cpc);
> +		else if (!__get_victim(sbi, &segno, gc_type) {
> +			segno = NULL_SEGNO;
> +			ret = write_checkpoint(sbi, &cpc);
> +		}
>  		if (ret)
>  			goto stop;
>  	} else if (gc_type == BG_GC && !background) {
> -- 
> 2.10.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

  reply	other threads:[~2017-02-24 18:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 20:43 [PATCH] f2fs: skip checkpoint if having a dirty segment but no prefree at BG_GC -> FG_GC Weichao Guo
2017-02-24 18:49 ` Jaegeuk Kim [this message]
2017-02-25  8:20   ` guoweichao
2017-02-25 19:56     ` Jaegeuk Kim
2017-02-27  3:25       ` Chao Yu
2017-02-27 18:05         ` Jaegeuk Kim
2017-02-27 23:49           ` Jaegeuk Kim
2017-02-28 10:51             ` Chao Yu
2017-03-01 19:24               ` Jaegeuk Kim

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=20170224184959.GD39009@jaegeuk.local \
    --to=jaegeuk@kernel.org \
    --cc=guoweichao@huawei.com \
    --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.