linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yunlei He <heyunlei@huawei.com>
Cc: yuchao@huawei.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: get victim segment again after new cp
Date: Thu, 21 Jul 2016 09:44:49 -0700	[thread overview]
Message-ID: <20160721164449.GA812@jaegeuk> (raw)
In-Reply-To: <1469107829-20459-1-git-send-email-heyunlei@huawei.com>

Hi Yunlei,

The problem may be the above stale segno.
How about this?

---
 fs/f2fs/gc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index de6c41c..8a0ed89 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -908,10 +908,12 @@ gc_more:
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		if (__get_victim(sbi, &segno, gc_type) || prefree_segments(sbi))
+		if (__get_victim(sbi, &segno, gc_type) || prefree_segments(sbi)) {
+			segno = NULL_SEGNO;
 			write_checkpoint(sbi, &cpc);
-		else if (has_not_enough_free_secs(sbi, 0))
+		} else if (has_not_enough_free_secs(sbi, 0)) {
 			write_checkpoint(sbi, &cpc);
+		}
 	}
 
 	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
-- 
2.8.3

On Thu, Jul 21, 2016 at 09:30:29PM +0800, Yunlei He wrote:
> previous segment selected may become free after write_checkpoint,
> so here, we select victim again.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/gc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index de6c41c..704e2e1 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -914,7 +914,7 @@ gc_more:
>  			write_checkpoint(sbi, &cpc);
>  	}
>  
> -	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
> +	if (!__get_victim(sbi, &segno, gc_type) && segno == NULL_SEGNO)
>  		goto stop;
>  	ret = 0;
>  
> -- 
> 1.9.1

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

      reply	other threads:[~2016-07-21 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 13:30 [PATCH] f2fs: get victim segment again after new cp Yunlei He
2016-07-21 16:44 ` Jaegeuk Kim [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=20160721164449.GA812@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=heyunlei@huawei.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yuchao@huawei.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 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).