linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix heap mode to reset it back
@ 2018-01-29  3:37 Yunlong Song
  2018-01-29  8:12 ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Yunlong Song @ 2018-01-29  3:37 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
  Cc: miaoxie, bintian.wang, shengyong1, heyunlei, linux-fsdevel,
	linux-f2fs-devel, linux-kernel

Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
and hot data in the beginning of partition") introduces another mount
option, heap, to reset it back. But it does not do anything for heap
mode, so fix it.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/gc.c      | 5 +++--
 fs/f2fs/segment.c | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index aa720cc..b9d93fd 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
 	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
 		p->max_search = sbi->max_victim_search;
 
-	/* let's select beginning hot/small space first */
-	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
+	/* let's select beginning hot/small space first in no_heap mode*/
+	if (test_opt(sbi, NOHEAP) &&
+		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
 		p->offset = 0;
 	else
 		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index e5739ce..77a48c4 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
 	if (sbi->segs_per_sec != 1)
 		return CURSEG_I(sbi, type)->segno;
 
-	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
+	if (test_opt(sbi, NOHEAP) &&
+		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
 		return 0;
 
 	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: fix heap mode to reset it back
  2018-01-29  3:37 [PATCH] f2fs: fix heap mode to reset it back Yunlong Song
@ 2018-01-29  8:12 ` Chao Yu
  2018-01-29  8:31   ` Yunlong Song
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2018-01-29  8:12 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, shengyong1, heyunlei, linux-fsdevel,
	linux-f2fs-devel, linux-kernel

Hi Yunlong,

On 2018/1/29 11:37, Yunlong Song wrote:
> Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
> and hot data in the beginning of partition") introduces another mount
> option, heap, to reset it back. But it does not do anything for heap
> mode, so fix it.

I think Jaegeuk did three things in that patch:
a) add missing heap mount option handling in ->show_options.
b) set noheap by default.
c) change allocation policy to the one that allocate hotdata & nodes in the
front of main are intensively.

They could be separated, independent, and I don't see such intention that
we can only use c) the new introduced allocation policy in noheap mode.

Anyway, I think Jaegeuk can help to double check that.

Thanks,

> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/gc.c      | 5 +++--
>  fs/f2fs/segment.c | 3 ++-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index aa720cc..b9d93fd 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
>  	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
>  		p->max_search = sbi->max_victim_search;
>  
> -	/* let's select beginning hot/small space first */
> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
> +	/* let's select beginning hot/small space first in no_heap mode*/
> +	if (test_opt(sbi, NOHEAP) &&
> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>  		p->offset = 0;
>  	else
>  		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index e5739ce..77a48c4 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
>  	if (sbi->segs_per_sec != 1)
>  		return CURSEG_I(sbi, type)->segno;
>  
> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
> +	if (test_opt(sbi, NOHEAP) &&
> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>  		return 0;
>  
>  	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: fix heap mode to reset it back
  2018-01-29  8:12 ` Chao Yu
@ 2018-01-29  8:31   ` Yunlong Song
  2018-01-29  9:01     ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Yunlong Song @ 2018-01-29  8:31 UTC (permalink / raw)
  To: Chao Yu, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, shengyong1, heyunlei, linux-fsdevel,
	linux-f2fs-devel, linux-kernel

The old commit allocates hot data & nodes in the beginning of partition 
both for heap and
noheap mode. But from the commit message, the heap mode should be like 
before, i.e.,
allocate hot data & nodes from curseg to left.

On 2018/1/29 16:12, Chao Yu wrote:
> Hi Yunlong,
>
> On 2018/1/29 11:37, Yunlong Song wrote:
>> Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
>> and hot data in the beginning of partition") introduces another mount
>> option, heap, to reset it back. But it does not do anything for heap
>> mode, so fix it.
> I think Jaegeuk did three things in that patch:
> a) add missing heap mount option handling in ->show_options.
> b) set noheap by default.
> c) change allocation policy to the one that allocate hotdata & nodes in the
> front of main are intensively.
>
> They could be separated, independent, and I don't see such intention that
> we can only use c) the new introduced allocation policy in noheap mode.
>
> Anyway, I think Jaegeuk can help to double check that.
>
> Thanks,
>
>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>> ---
>>   fs/f2fs/gc.c      | 5 +++--
>>   fs/f2fs/segment.c | 3 ++-
>>   2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>> index aa720cc..b9d93fd 100644
>> --- a/fs/f2fs/gc.c
>> +++ b/fs/f2fs/gc.c
>> @@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
>>   	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
>>   		p->max_search = sbi->max_victim_search;
>>   
>> -	/* let's select beginning hot/small space first */
>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>> +	/* let's select beginning hot/small space first in no_heap mode*/
>> +	if (test_opt(sbi, NOHEAP) &&
>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>   		p->offset = 0;
>>   	else
>>   		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index e5739ce..77a48c4 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
>>   	if (sbi->segs_per_sec != 1)
>>   		return CURSEG_I(sbi, type)->segno;
>>   
>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>> +	if (test_opt(sbi, NOHEAP) &&
>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>   		return 0;
>>   
>>   	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
>>
>
> .
>

-- 
Thanks,
Yunlong Song

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: fix heap mode to reset it back
  2018-01-29  8:31   ` Yunlong Song
@ 2018-01-29  9:01     ` Chao Yu
  2018-01-31  1:39       ` Jaegeuk Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2018-01-29  9:01 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, chao, yunlong.song
  Cc: miaoxie, bintian.wang, shengyong1, heyunlei, linux-fsdevel,
	linux-f2fs-devel, linux-kernel

On 2018/1/29 16:31, Yunlong Song wrote:
> The old commit allocates hot data & nodes in the beginning of partition 
> both for heap and
> noheap mode. But from the commit message, the heap mode should be like 
> before, i.e.,
> allocate hot data & nodes from curseg to left.

Let's ping Jaegeuk to check that, :)

Thanks,

> 
> On 2018/1/29 16:12, Chao Yu wrote:
>> Hi Yunlong,
>>
>> On 2018/1/29 11:37, Yunlong Song wrote:
>>> Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
>>> and hot data in the beginning of partition") introduces another mount
>>> option, heap, to reset it back. But it does not do anything for heap
>>> mode, so fix it.
>> I think Jaegeuk did three things in that patch:
>> a) add missing heap mount option handling in ->show_options.
>> b) set noheap by default.
>> c) change allocation policy to the one that allocate hotdata & nodes in the
>> front of main are intensively.
>>
>> They could be separated, independent, and I don't see such intention that
>> we can only use c) the new introduced allocation policy in noheap mode.
>>
>> Anyway, I think Jaegeuk can help to double check that.
>>
>> Thanks,
>>
>>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>>> ---
>>>   fs/f2fs/gc.c      | 5 +++--
>>>   fs/f2fs/segment.c | 3 ++-
>>>   2 files changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>>> index aa720cc..b9d93fd 100644
>>> --- a/fs/f2fs/gc.c
>>> +++ b/fs/f2fs/gc.c
>>> @@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
>>>   	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
>>>   		p->max_search = sbi->max_victim_search;
>>>   
>>> -	/* let's select beginning hot/small space first */
>>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>>> +	/* let's select beginning hot/small space first in no_heap mode*/
>>> +	if (test_opt(sbi, NOHEAP) &&
>>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>>   		p->offset = 0;
>>>   	else
>>>   		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index e5739ce..77a48c4 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
>>>   	if (sbi->segs_per_sec != 1)
>>>   		return CURSEG_I(sbi, type)->segno;
>>>   
>>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>>> +	if (test_opt(sbi, NOHEAP) &&
>>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>>   		return 0;
>>>   
>>>   	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
>>>
>>
>> .
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: fix heap mode to reset it back
  2018-01-29  9:01     ` Chao Yu
@ 2018-01-31  1:39       ` Jaegeuk Kim
  2018-01-31  2:19         ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2018-01-31  1:39 UTC (permalink / raw)
  To: Chao Yu
  Cc: Yunlong Song, chao, yunlong.song, miaoxie, bintian.wang,
	shengyong1, heyunlei, linux-fsdevel, linux-f2fs-devel,
	linux-kernel

On 01/29, Chao Yu wrote:
> On 2018/1/29 16:31, Yunlong Song wrote:
> > The old commit allocates hot data & nodes in the beginning of partition 
> > both for heap and
> > noheap mode. But from the commit message, the heap mode should be like 
> > before, i.e.,
> > allocate hot data & nodes from curseg to left.
> 
> Let's ping Jaegeuk to check that, :)

Yup, I missed to add this condition. :)

> 
> Thanks,
> 
> > 
> > On 2018/1/29 16:12, Chao Yu wrote:
> >> Hi Yunlong,
> >>
> >> On 2018/1/29 11:37, Yunlong Song wrote:
> >>> Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
> >>> and hot data in the beginning of partition") introduces another mount
> >>> option, heap, to reset it back. But it does not do anything for heap
> >>> mode, so fix it.
> >> I think Jaegeuk did three things in that patch:
> >> a) add missing heap mount option handling in ->show_options.
> >> b) set noheap by default.
> >> c) change allocation policy to the one that allocate hotdata & nodes in the
> >> front of main are intensively.
> >>
> >> They could be separated, independent, and I don't see such intention that
> >> we can only use c) the new introduced allocation policy in noheap mode.
> >>
> >> Anyway, I think Jaegeuk can help to double check that.
> >>
> >> Thanks,
> >>
> >>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> >>> ---
> >>>   fs/f2fs/gc.c      | 5 +++--
> >>>   fs/f2fs/segment.c | 3 ++-
> >>>   2 files changed, 5 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> >>> index aa720cc..b9d93fd 100644
> >>> --- a/fs/f2fs/gc.c
> >>> +++ b/fs/f2fs/gc.c
> >>> @@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
> >>>   	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
> >>>   		p->max_search = sbi->max_victim_search;
> >>>   
> >>> -	/* let's select beginning hot/small space first */
> >>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
> >>> +	/* let's select beginning hot/small space first in no_heap mode*/
> >>> +	if (test_opt(sbi, NOHEAP) &&
> >>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
> >>>   		p->offset = 0;
> >>>   	else
> >>>   		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
> >>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> >>> index e5739ce..77a48c4 100644
> >>> --- a/fs/f2fs/segment.c
> >>> +++ b/fs/f2fs/segment.c
> >>> @@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
> >>>   	if (sbi->segs_per_sec != 1)
> >>>   		return CURSEG_I(sbi, type)->segno;
> >>>   
> >>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
> >>> +	if (test_opt(sbi, NOHEAP) &&
> >>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
> >>>   		return 0;
> >>>   
> >>>   	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
> >>>
> >>
> >> .
> >>
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: fix heap mode to reset it back
  2018-01-31  1:39       ` Jaegeuk Kim
@ 2018-01-31  2:19         ` Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2018-01-31  2:19 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Yunlong Song, chao, yunlong.song, miaoxie, bintian.wang,
	shengyong1, heyunlei, linux-fsdevel, linux-f2fs-devel,
	linux-kernel

On 2018/1/31 9:39, Jaegeuk Kim wrote:
> On 01/29, Chao Yu wrote:
>> On 2018/1/29 16:31, Yunlong Song wrote:
>>> The old commit allocates hot data & nodes in the beginning of partition 
>>> both for heap and
>>> noheap mode. But from the commit message, the heap mode should be like 
>>> before, i.e.,
>>> allocate hot data & nodes from curseg to left.
>>
>> Let's ping Jaegeuk to check that, :)
> 
> Yup, I missed to add this condition. :)

Alright, if so, it needs to Cc stable mailing list, as this patch should
fix to reset back allocation policy of heap mode in old kernel too.

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>> On 2018/1/29 16:12, Chao Yu wrote:
>>>> Hi Yunlong,
>>>>
>>>> On 2018/1/29 11:37, Yunlong Song wrote:
>>>>> Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
>>>>> and hot data in the beginning of partition") introduces another mount
>>>>> option, heap, to reset it back. But it does not do anything for heap
>>>>> mode, so fix it.
>>>> I think Jaegeuk did three things in that patch:
>>>> a) add missing heap mount option handling in ->show_options.
>>>> b) set noheap by default.
>>>> c) change allocation policy to the one that allocate hotdata & nodes in the
>>>> front of main are intensively.
>>>>
>>>> They could be separated, independent, and I don't see such intention that
>>>> we can only use c) the new introduced allocation policy in noheap mode.
>>>>
>>>> Anyway, I think Jaegeuk can help to double check that.
>>>>
>>>> Thanks,
>>>>
>>>>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>>>>> ---
>>>>>   fs/f2fs/gc.c      | 5 +++--
>>>>>   fs/f2fs/segment.c | 3 ++-
>>>>>   2 files changed, 5 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>>>>> index aa720cc..b9d93fd 100644
>>>>> --- a/fs/f2fs/gc.c
>>>>> +++ b/fs/f2fs/gc.c
>>>>> @@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
>>>>>   	if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
>>>>>   		p->max_search = sbi->max_victim_search;
>>>>>   
>>>>> -	/* let's select beginning hot/small space first */
>>>>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>>>>> +	/* let's select beginning hot/small space first in no_heap mode*/
>>>>> +	if (test_opt(sbi, NOHEAP) &&
>>>>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>>>>   		p->offset = 0;
>>>>>   	else
>>>>>   		p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>> index e5739ce..77a48c4 100644
>>>>> --- a/fs/f2fs/segment.c
>>>>> +++ b/fs/f2fs/segment.c
>>>>> @@ -2167,7 +2167,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
>>>>>   	if (sbi->segs_per_sec != 1)
>>>>>   		return CURSEG_I(sbi, type)->segno;
>>>>>   
>>>>> -	if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
>>>>> +	if (test_opt(sbi, NOHEAP) &&
>>>>> +		(type == CURSEG_HOT_DATA || IS_NODESEG(type)))
>>>>>   		return 0;
>>>>>   
>>>>>   	if (SIT_I(sbi)->last_victim[ALLOC_NEXT])
>>>>>
>>>>
>>>> .
>>>>
>>>
> 
> .
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-31  2:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-29  3:37 [PATCH] f2fs: fix heap mode to reset it back Yunlong Song
2018-01-29  8:12 ` Chao Yu
2018-01-29  8:31   ` Yunlong Song
2018-01-29  9:01     ` Chao Yu
2018-01-31  1:39       ` Jaegeuk Kim
2018-01-31  2:19         ` Chao Yu

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).