f2fs: no need to create issue_discard_thread if it exists
diff mbox

Message ID 1499339134-104480-1-git-send-email-yunlong.song@huawei.com
State New
Headers show

Commit Message

Yunlong Song July 6, 2017, 11:05 a.m. UTC
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chao Yu July 6, 2017, 1:16 p.m. UTC | #1
Hi Yunlong,

It looks there is no way to create discard thread redundantly,
so here we don't need to check this?

Thanks,

On 2017/7/6 19:05, Yunlong Song wrote:
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/segment.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 4c246e3..b48d004 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1417,6 +1417,8 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
>  
>  	if (SM_I(sbi)->dcc_info) {
>  		dcc = SM_I(sbi)->dcc_info;
> +		if (dcc->f2fs_issue_discard)
> +			return err;
>  		goto init_thread;
>  	}
>  
>
Yunlong Song July 7, 2017, 2:02 a.m. UTC | #2
It's fine unless create_discard_cmd_control is used in remount flow in the future.

On 2017/7/6 21:16, Chao Yu wrote:
> Hi Yunlong,
>
> It looks there is no way to create discard thread redundantly,
> so here we don't need to check this?
>
> Thanks,
>
> On 2017/7/6 19:05, Yunlong Song wrote:
>> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
>> ---
>>  fs/f2fs/segment.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 4c246e3..b48d004 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -1417,6 +1417,8 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
>>  
>>  	if (SM_I(sbi)->dcc_info) {
>>  		dcc = SM_I(sbi)->dcc_info;
>> +		if (dcc->f2fs_issue_discard)
>> +			return err;
>>  		goto init_thread;
>>  	}
>>  
>>
> .
>

Patch
diff mbox

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 4c246e3..b48d004 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1417,6 +1417,8 @@  static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
 
 	if (SM_I(sbi)->dcc_info) {
 		dcc = SM_I(sbi)->dcc_info;
+		if (dcc->f2fs_issue_discard)
+			return err;
 		goto init_thread;
 	}