* [PATCH] f2fs: add a judgment in add_discard_addrs @ 2015-09-08 10:51 Yunlei He 2015-09-08 11:14 ` Chao Yu 0 siblings, 1 reply; 5+ messages in thread From: Yunlei He @ 2015-09-08 10:51 UTC (permalink / raw) To: chao2.yu, jaegeuk, linux-f2fs-devel CP_DISCARD traverse all segments in fstrim_range to add small discards, it is better to select entry->len bigger than trim_minlen. Signed-off-by: Yunlei He <heyunlei@huawei.com> --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 78e6d06..a0dab7a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -599,7 +599,8 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc) break; end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); - __add_discard_entry(sbi, cpc, se, start, end); + if(force && cpc->trim_minlen >= (end - start)) + __add_discard_entry(sbi, cpc, se, start, end); } } -- 1.9.1 ------------------------------------------------------------------------------ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] f2fs: add a judgment in add_discard_addrs 2015-09-08 10:51 [PATCH] f2fs: add a judgment in add_discard_addrs Yunlei He @ 2015-09-08 11:14 ` Chao Yu 2015-09-08 23:53 ` He YunLei 0 siblings, 1 reply; 5+ messages in thread From: Chao Yu @ 2015-09-08 11:14 UTC (permalink / raw) To: 'Yunlei He', jaegeuk, linux-f2fs-devel Hi Yunlei, > -----Original Message----- > From: Yunlei He [mailto:heyunlei@huawei.com] > Sent: Tuesday, September 08, 2015 6:51 PM > To: chao2.yu@samsung.com; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net > Cc: bintian.wang@huawei.com; Yunlei He > Subject: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs > > CP_DISCARD traverse all segments in fstrim_range to add small discards, > it is better to select entry->len bigger than trim_minlen. If we mount with 'discard' option, f2fs will trigger real-time discard when do checkpoint. If we add judgment condition here, fragmented invalid blocks will not be discarded since we stop adding them in pending list through __add_discard_entry. Thanks, > > Signed-off-by: Yunlei He <heyunlei@huawei.com> > --- > fs/f2fs/segment.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 78e6d06..a0dab7a 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -599,7 +599,8 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control > *cpc) > break; > > end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); > - __add_discard_entry(sbi, cpc, se, start, end); > + if(force && cpc->trim_minlen >= (end - start)) > + __add_discard_entry(sbi, cpc, se, start, end); > } > } > > -- > 1.9.1 ------------------------------------------------------------------------------ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] f2fs: add a judgment in add_discard_addrs 2015-09-08 11:14 ` Chao Yu @ 2015-09-08 23:53 ` He YunLei 2015-09-09 1:11 ` Chao Yu 0 siblings, 1 reply; 5+ messages in thread From: He YunLei @ 2015-09-08 23:53 UTC (permalink / raw) To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel On 2015/9/8 19:14, Chao Yu wrote: > Hi Yunlei, > >> -----Original Message----- >> From: Yunlei He [mailto:heyunlei@huawei.com] >> Sent: Tuesday, September 08, 2015 6:51 PM >> To: chao2.yu@samsung.com; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net >> Cc: bintian.wang@huawei.com; Yunlei He >> Subject: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs >> >> CP_DISCARD traverse all segments in fstrim_range to add small discards, >> it is better to select entry->len bigger than trim_minlen. > > If we mount with 'discard' option, f2fs will trigger real-time discard > when do checkpoint. If we add judgment condition here, fragmented invalid > blocks will not be discarded since we stop adding them in pending list > through __add_discard_entry. This judgment condition is only valid for cp reason CP_DISCARD, and has no influence to other checkpoint. The process of fstrim adds all invalid blocks in pending list and deletes entries which len < trim_minlen when issue discard. Can we do the selection when added? Thanks, > > Thanks, > >> >> Signed-off-by: Yunlei He <heyunlei@huawei.com> >> --- >> fs/f2fs/segment.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index 78e6d06..a0dab7a 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -599,7 +599,8 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control >> *cpc) >> break; >> >> end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); >> - __add_discard_entry(sbi, cpc, se, start, end); >> + if(force && cpc->trim_minlen >= (end - start)) >> + __add_discard_entry(sbi, cpc, se, start, end); >> } >> } >> >> -- >> 1.9.1 > > > ------------------------------------------------------------------------------ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] f2fs: add a judgment in add_discard_addrs 2015-09-08 23:53 ` He YunLei @ 2015-09-09 1:11 ` Chao Yu 2015-09-09 2:32 ` He YunLei 0 siblings, 1 reply; 5+ messages in thread From: Chao Yu @ 2015-09-09 1:11 UTC (permalink / raw) To: 'He YunLei'; +Cc: jaegeuk, linux-f2fs-devel > -----Original Message----- > From: He YunLei [mailto:heyunlei@huawei.com] > Sent: Wednesday, September 09, 2015 7:54 AM > To: Chao Yu > Cc: jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net; bintian.wang@huawei.com > Subject: Re: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs > > On 2015/9/8 19:14, Chao Yu wrote: > > Hi Yunlei, > > > >> -----Original Message----- > >> From: Yunlei He [mailto:heyunlei@huawei.com] > >> Sent: Tuesday, September 08, 2015 6:51 PM > >> To: chao2.yu@samsung.com; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net > >> Cc: bintian.wang@huawei.com; Yunlei He > >> Subject: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs > >> > >> CP_DISCARD traverse all segments in fstrim_range to add small discards, > >> it is better to select entry->len bigger than trim_minlen. > > > > If we mount with 'discard' option, f2fs will trigger real-time discard > > when do checkpoint. If we add judgment condition here, fragmented invalid > > blocks will not be discarded since we stop adding them in pending list > > through __add_discard_entry. > > This judgment condition is only valid for cp reason CP_DISCARD, and has no influence > to other checkpoint. The process of fstrim adds all invalid blocks in pending list and > deletes entries which len < trim_minlen when issue discard. Can we do the selection > when added? __add_discard_entry will try to merge small discards in pending list, and merged discard may be the eligible candidate, so we'd better not skip that. Thanks, > > Thanks, > > > > > Thanks, > > > >> > >> Signed-off-by: Yunlei He <heyunlei@huawei.com> > >> --- > >> fs/f2fs/segment.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > >> index 78e6d06..a0dab7a 100644 > >> --- a/fs/f2fs/segment.c > >> +++ b/fs/f2fs/segment.c > >> @@ -599,7 +599,8 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control > >> *cpc) > >> break; > >> > >> end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); > >> - __add_discard_entry(sbi, cpc, se, start, end); > >> + if(force && cpc->trim_minlen >= (end - start)) > >> + __add_discard_entry(sbi, cpc, se, start, end); > >> } > >> } > >> > >> -- > >> 1.9.1 > > > > > > ------------------------------------------------------------------------------ Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] f2fs: add a judgment in add_discard_addrs 2015-09-09 1:11 ` Chao Yu @ 2015-09-09 2:32 ` He YunLei 0 siblings, 0 replies; 5+ messages in thread From: He YunLei @ 2015-09-09 2:32 UTC (permalink / raw) To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel On 2015/9/9 9:11, Chao Yu wrote: >> -----Original Message----- >> From: He YunLei [mailto:heyunlei@huawei.com] >> Sent: Wednesday, September 09, 2015 7:54 AM >> To: Chao Yu >> Cc: jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net; bintian.wang@huawei.com >> Subject: Re: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs >> >> On 2015/9/8 19:14, Chao Yu wrote: >>> Hi Yunlei, >>> >>>> -----Original Message----- >>>> From: Yunlei He [mailto:heyunlei@huawei.com] >>>> Sent: Tuesday, September 08, 2015 6:51 PM >>>> To: chao2.yu@samsung.com; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net >>>> Cc: bintian.wang@huawei.com; Yunlei He >>>> Subject: [f2fs-dev] [PATCH] f2fs: add a judgment in add_discard_addrs >>>> >>>> CP_DISCARD traverse all segments in fstrim_range to add small discards, >>>> it is better to select entry->len bigger than trim_minlen. >>> >>> If we mount with 'discard' option, f2fs will trigger real-time discard >>> when do checkpoint. If we add judgment condition here, fragmented invalid >>> blocks will not be discarded since we stop adding them in pending list >>> through __add_discard_entry. >> >> This judgment condition is only valid for cp reason CP_DISCARD, and has no influence >> to other checkpoint. The process of fstrim adds all invalid blocks in pending list and >> deletes entries which len < trim_minlen when issue discard. Can we do the selection >> when added? > > __add_discard_entry will try to merge small discards in pending list, and merged discard > may be the eligible candidate, so we'd better not skip that. > Yeah, I got it. But I think the probability of merge will not be too high. Thanks, > Thanks, > >> >> Thanks, >> >>> >>> Thanks, >>> >>>> >>>> Signed-off-by: Yunlei He <heyunlei@huawei.com> >>>> --- >>>> fs/f2fs/segment.c | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >>>> index 78e6d06..a0dab7a 100644 >>>> --- a/fs/f2fs/segment.c >>>> +++ b/fs/f2fs/segment.c >>>> @@ -599,7 +599,8 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control >>>> *cpc) >>>> break; >>>> >>>> end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1); >>>> - __add_discard_entry(sbi, cpc, se, start, end); >>>> + if(force && cpc->trim_minlen >= (end - start)) >>>> + __add_discard_entry(sbi, cpc, se, start, end); >>>> } >>>> } >>>> >>>> -- >>>> 1.9.1 >>> >>> >>> > > > . > ------------------------------------------------------------------------------ Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-09 2:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-08 10:51 [PATCH] f2fs: add a judgment in add_discard_addrs Yunlei He 2015-09-08 11:14 ` Chao Yu 2015-09-08 23:53 ` He YunLei 2015-09-09 1:11 ` Chao Yu 2015-09-09 2:32 ` He YunLei
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).