* [PATCH] f2fs: discard small invalid blocks in current active segments
@ 2017-08-26 12:49 ` Yunlong Song
0 siblings, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2017-08-26 12:49 UTC (permalink / raw)
To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
1. write file A with 5 blocks to current empty active segment
2. remove file A
3. write checkpoint
4. write file B with 507 blocks to the same active segment
If file B is alive all the time, the blocks used by file A will never be
discarded. So current active segment should also be treated as a candidate
for small discards.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
fs/f2fs/segment.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8375257..a2e7c8f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
return false;
if (!force) {
- if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
+ if (!test_opt(sbi, DISCARD) ||
+ (!se->valid_blocks &&
+ !IS_CURSEG(sbi, cpc->trim_start)) ||
SM_I(sbi)->dcc_info->nr_discards >=
SM_I(sbi)->dcc_info->max_discards)
return false;
--
1.8.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] f2fs: discard small invalid blocks in current active segments
@ 2017-08-26 12:49 ` Yunlong Song
0 siblings, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2017-08-26 12:49 UTC (permalink / raw)
To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
1. write file A with 5 blocks to current empty active segment
2. remove file A
3. write checkpoint
4. write file B with 507 blocks to the same active segment
If file B is alive all the time, the blocks used by file A will never be
discarded. So current active segment should also be treated as a candidate
for small discards.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
fs/f2fs/segment.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8375257..a2e7c8f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
return false;
if (!force) {
- if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
+ if (!test_opt(sbi, DISCARD) ||
+ (!se->valid_blocks &&
+ !IS_CURSEG(sbi, cpc->trim_start)) ||
SM_I(sbi)->dcc_info->nr_discards >=
SM_I(sbi)->dcc_info->max_discards)
return false;
--
1.8.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
2017-08-26 12:49 ` Yunlong Song
@ 2017-08-28 9:59 ` Chao Yu
-1 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2017-08-28 9:59 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
On 2017/8/26 20:49, Yunlong Song wrote:
> 1. write file A with 5 blocks to current empty active segment
> 2. remove file A
> 3. write checkpoint
> 4. write file B with 507 blocks to the same active segment
>
> If file B is alive all the time, the blocks used by file A will never be
> discarded. So current active segment should also be treated as a candidate
> for small discards.
I don't think that would be a big issue, since there will not be any freezing
log headers, once log header moves, later invalid blocks could be discarded.
Thanks,
>
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> fs/f2fs/segment.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8375257..a2e7c8f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
> return false;
>
> if (!force) {
> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
> + if (!test_opt(sbi, DISCARD) ||
> + (!se->valid_blocks &&
> + !IS_CURSEG(sbi, cpc->trim_start)) ||
> SM_I(sbi)->dcc_info->nr_discards >=
> SM_I(sbi)->dcc_info->max_discards)
> return false;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
@ 2017-08-28 9:59 ` Chao Yu
0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2017-08-28 9:59 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
On 2017/8/26 20:49, Yunlong Song wrote:
> 1. write file A with 5 blocks to current empty active segment
> 2. remove file A
> 3. write checkpoint
> 4. write file B with 507 blocks to the same active segment
>
> If file B is alive all the time, the blocks used by file A will never be
> discarded. So current active segment should also be treated as a candidate
> for small discards.
I don't think that would be a big issue, since there will not be any freezing
log headers, once log header moves, later invalid blocks could be discarded.
Thanks,
>
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> fs/f2fs/segment.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8375257..a2e7c8f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
> return false;
>
> if (!force) {
> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
> + if (!test_opt(sbi, DISCARD) ||
> + (!se->valid_blocks &&
> + !IS_CURSEG(sbi, cpc->trim_start)) ||
> SM_I(sbi)->dcc_info->nr_discards >=
> SM_I(sbi)->dcc_info->max_discards)
> return false;
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
2017-08-28 9:59 ` Chao Yu
@ 2017-08-28 13:21 ` Yunlong Song
-1 siblings, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2017-08-28 13:21 UTC (permalink / raw)
To: Chao Yu, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
How? Can the invalid blocks of file A be discarded, if file B is alive
all the time and fggc_threshold is 507 ?
On 2017/8/28 17:59, Chao Yu wrote:
> On 2017/8/26 20:49, Yunlong Song wrote:
>> 1. write file A with 5 blocks to current empty active segment
>> 2. remove file A
>> 3. write checkpoint
>> 4. write file B with 507 blocks to the same active segment
>>
>> If file B is alive all the time, the blocks used by file A will never be
>> discarded. So current active segment should also be treated as a candidate
>> for small discards.
> I don't think that would be a big issue, since there will not be any freezing
> log headers, once log header moves, later invalid blocks could be discarded.
>
> Thanks,
>
>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>> ---
>> fs/f2fs/segment.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 8375257..a2e7c8f 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
>> return false;
>>
>> if (!force) {
>> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
>> + if (!test_opt(sbi, DISCARD) ||
>> + (!se->valid_blocks &&
>> + !IS_CURSEG(sbi, cpc->trim_start)) ||
>> SM_I(sbi)->dcc_info->nr_discards >=
>> SM_I(sbi)->dcc_info->max_discards)
>> return false;
>>
>
> .
>
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
@ 2017-08-28 13:21 ` Yunlong Song
0 siblings, 0 replies; 8+ messages in thread
From: Yunlong Song @ 2017-08-28 13:21 UTC (permalink / raw)
To: Chao Yu, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
How? Can the invalid blocks of file A be discarded, if file B is alive
all the time and fggc_threshold is 507 ?
On 2017/8/28 17:59, Chao Yu wrote:
> On 2017/8/26 20:49, Yunlong Song wrote:
>> 1. write file A with 5 blocks to current empty active segment
>> 2. remove file A
>> 3. write checkpoint
>> 4. write file B with 507 blocks to the same active segment
>>
>> If file B is alive all the time, the blocks used by file A will never be
>> discarded. So current active segment should also be treated as a candidate
>> for small discards.
> I don't think that would be a big issue, since there will not be any freezing
> log headers, once log header moves, later invalid blocks could be discarded.
>
> Thanks,
>
>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>> ---
>> fs/f2fs/segment.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 8375257..a2e7c8f 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
>> return false;
>>
>> if (!force) {
>> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
>> + if (!test_opt(sbi, DISCARD) ||
>> + (!se->valid_blocks &&
>> + !IS_CURSEG(sbi, cpc->trim_start)) ||
>> SM_I(sbi)->dcc_info->nr_discards >=
>> SM_I(sbi)->dcc_info->max_discards)
>> return false;
>>
>
> .
>
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
2017-08-28 13:21 ` Yunlong Song
@ 2017-08-29 10:06 ` Chao Yu
-1 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2017-08-29 10:06 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
On 2017/8/28 21:21, Yunlong Song wrote:
> How? Can the invalid blocks of file A be discarded, if file B is alive
> all the time and fggc_threshold is 507 ?
As I traced, with small discard, we scan discard candidates from all dirty
segments which also include current segment, so seems we don't need to wait log
header moving on.
Thanks,
>
> On 2017/8/28 17:59, Chao Yu wrote:
>> On 2017/8/26 20:49, Yunlong Song wrote:
>>> 1. write file A with 5 blocks to current empty active segment
>>> 2. remove file A
>>> 3. write checkpoint
>>> 4. write file B with 507 blocks to the same active segment
>>>
>>> If file B is alive all the time, the blocks used by file A will never be
>>> discarded. So current active segment should also be treated as a candidate
>>> for small discards.
>> I don't think that would be a big issue, since there will not be any freezing
>> log headers, once log header moves, later invalid blocks could be discarded.
>>
>> Thanks,
>>
>>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>>> ---
>>> fs/f2fs/segment.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index 8375257..a2e7c8f 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
>>> return false;
>>>
>>> if (!force) {
>>> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
>>> + if (!test_opt(sbi, DISCARD) ||
>>> + (!se->valid_blocks &&
>>> + !IS_CURSEG(sbi, cpc->trim_start)) ||
>>> SM_I(sbi)->dcc_info->nr_discards >=
>>> SM_I(sbi)->dcc_info->max_discards)
>>> return false;
>>>
>>
>> .
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] f2fs: discard small invalid blocks in current active segments
@ 2017-08-29 10:06 ` Chao Yu
0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2017-08-29 10:06 UTC (permalink / raw)
To: Yunlong Song, jaegeuk, chao, yunlong.song
Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel
On 2017/8/28 21:21, Yunlong Song wrote:
> How? Can the invalid blocks of file A be discarded, if file B is alive
> all the time and fggc_threshold is 507 ?
As I traced, with small discard, we scan discard candidates from all dirty
segments which also include current segment, so seems we don't need to wait log
header moving on.
Thanks,
>
> On 2017/8/28 17:59, Chao Yu wrote:
>> On 2017/8/26 20:49, Yunlong Song wrote:
>>> 1. write file A with 5 blocks to current empty active segment
>>> 2. remove file A
>>> 3. write checkpoint
>>> 4. write file B with 507 blocks to the same active segment
>>>
>>> If file B is alive all the time, the blocks used by file A will never be
>>> discarded. So current active segment should also be treated as a candidate
>>> for small discards.
>> I don't think that would be a big issue, since there will not be any freezing
>> log headers, once log header moves, later invalid blocks could be discarded.
>>
>> Thanks,
>>
>>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>>> ---
>>> fs/f2fs/segment.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index 8375257..a2e7c8f 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
>>> return false;
>>>
>>> if (!force) {
>>> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
>>> + if (!test_opt(sbi, DISCARD) ||
>>> + (!se->valid_blocks &&
>>> + !IS_CURSEG(sbi, cpc->trim_start)) ||
>>> SM_I(sbi)->dcc_info->nr_discards >=
>>> SM_I(sbi)->dcc_info->max_discards)
>>> return false;
>>>
>>
>> .
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-29 10:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26 12:49 [PATCH] f2fs: discard small invalid blocks in current active segments Yunlong Song
2017-08-26 12:49 ` Yunlong Song
2017-08-28 9:59 ` Chao Yu
2017-08-28 9:59 ` Chao Yu
2017-08-28 13:21 ` Yunlong Song
2017-08-28 13:21 ` Yunlong Song
2017-08-29 10:06 ` Chao Yu
2017-08-29 10:06 ` Chao Yu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.