Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586621

Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no candidate

From Jaegeuk Kim <jaegeuk@kernel.org>
Newsgroups linux.kernel
Subject Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no candidate
Date 2017-02-23 03:50 +0100
Message-ID <tdRDI-2Xg-9@gated-at.bofh.it> (permalink)
References <sUazf-86o-3@gated-at.bofh.it> <sUazf-86o-9@gated-at.bofh.it> <tdzx8-6xa-9@gated-at.bofh.it> <tdMXo-80p-3@gated-at.bofh.it> <tdRaF-2LC-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/23, Chao Yu wrote:
> Hi Jaegeuk,
> 
> On 2017/2/23 5:26, Jaegeuk Kim wrote:
...
> >>> +	__u64 trim_start = cpc->trim_start;
> >>
> >> bool has_candidate = false;
> >>
> >>> +
> >>> +	mutex_lock(&SIT_I(sbi)->sentry_lock);
> >>> +	for (; trim_start <= cpc->trim_end; trim_start++)
> >>> +		if (add_discard_addrs(sbi, cpc, true))
> >>> +			break;
> >>
> >> for (; cpc->trim_start <= cpc->trim_end; cpc->trim_start++)
> >> 	if (add_discard_addrs(sbi, cpc, true)) {
> >> 		has_candidate = true;
> >> 		break;
> >> 	}
> > 
> > Why do we need to do like this in which needs additional variable with multiple
> > assignment?
> 
> Because add_discard_addrs will check segment which cpc->trim_start points to,
> but if we do not increase cpc->trim_start in loop, we will always check one
> segment, right?

Yeah~ ;)

> 
> Thanks,
> 
> > 
> > Thanks,
> > 
> >>
> >> cpc->trim_start = trim_start;
> >>
> >>> +	mutex_unlock(&SIT_I(sbi)->sentry_lock);
> >>> +
> >>> +	return trim_start <= cpc->trim_end;
> >>
> >> return has_candidate;
> >>
> >> Thanks,
> >>
> >>> +}
> >>> +
> >>>  int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
> >>>  {
> >>>  	__u64 start = F2FS_BYTES_TO_BLK(range->start);
> >>> @@ -2251,7 +2269,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> >>>  			/* add discard candidates */
> >>>  			if (cpc->reason != CP_DISCARD) {
> >>>  				cpc->trim_start = segno;
> >>> -				add_discard_addrs(sbi, cpc);
> >>> +				add_discard_addrs(sbi, cpc, false);
> >>>  			}
> >>>  
> >>>  			if (to_journal) {
> >>> @@ -2289,7 +2307,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> >>>  		__u64 trim_start = cpc->trim_start;
> >>>  
> >>>  		for (; cpc->trim_start <= cpc->trim_end; cpc->trim_start++)
> >>> -			add_discard_addrs(sbi, cpc);
> >>> +			add_discard_addrs(sbi, cpc, false);
> >>>  
> >>>  		cpc->trim_start = trim_start;
> >>>  	}
> >>>
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Linux-f2fs-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > 
> > .
> > 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no  candidate Chao Yu <yuchao0@huawei.com> - 2017-02-22 08:30 +0100
  Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no  candidate Jaegeuk Kim <jaegeuk@kernel.org> - 2017-02-22 22:50 +0100
    Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no  candidate Chao Yu <yuchao0@huawei.com> - 2017-02-23 03:20 +0100
      Re: [f2fs-dev] [PATCH 10/10] f2fs: return fs_trim if there is no  candidate Jaegeuk Kim <jaegeuk@kernel.org> - 2017-02-23 03:50 +0100

csiph-web