From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] f2fs: get victim segment again after new cp
Date: Mon, 25 Jul 2016 11:40:05 -0700	[thread overview]
Message-ID: <20160725184005.GB56718@jaegeuk> (raw)
In-Reply-To: <6fbd66c3-ccfc-0389-dde5-81b901cb4586@kernel.org>
On Sun, Jul 24, 2016 at 06:38:46AM +0800, Chao Yu wrote:
...
> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> >> index de6c41c..ec17096 100644
> >> --- a/fs/f2fs/gc.c
> >> +++ b/fs/f2fs/gc.c
> >> @@ -908,10 +908,14 @@ 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)) {
> >>  			write_checkpoint(sbi, &cpc);
> >> -		else if (has_not_enough_free_secs(sbi, 0))
> > 
> > If segno is NULL_SEGNO, we get a panic when checking the below conditions.
> > Anyway, I don't think we need this condition at all.
> 
> I thinks the condition which trigger our f2fs_bug_on is really a corner case,
> we'd better not waste the victim we found everytime, especially for these
> victims from last background gc's victims.
> 
> What about checking segno first?
> 
> if(segno != NULL_SEGNO && (!get_valid_blocks(sbi, segno, sbi->segs_per_sec) ||
> 	IS_CURSEC(sbi, GET_SECNO(sbi, segno)))
> 	segno = NULL_SEGNO;
My viewpoint is write_checkpoint() flushes node and dentry pages, which provides
another better victims. Another concern is get_valid_blocks and IS_CURSEG are
not covered by any lock.
Thanks,
> 
> Thanks,
> 
> > Let me remove them and just set NULL_SEGNO only after checkpoint.
> > Please check the dev-test repo.
> > 
> > Thanks,
> > 
> >> +			if(!get_valid_blocks(sbi, segno, sbi->segs_per_sec)
> >> +					|| IS_CURSEC(sbi, segno / sbi->segs_per_sec))
> >> +				segno = NULL_SEGNO;
> >> +		} else if (has_not_enough_free_secs(sbi, 0)) {
> >>  			write_checkpoint(sbi, &cpc);
> >> +		}
> >>  	}
> >>  
> >>  	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
> >> -- 
> >> 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
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > 
------------------------------------------------------------------------------
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
     prev parent reply	other threads:[~2016-07-25 18:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 11:08 [PATCH v2] f2fs: get victim segment again after new cp Yunlei He
2016-07-22 18:59 ` Jaegeuk Kim
2016-07-23 22:38   ` Chao Yu
2016-07-25 18:40     ` 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=20160725184005.GB56718@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=chao@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 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).