linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: remove unnecessary judgments in __insert_free_nid()
@ 2020-06-26 14:39 Liu Song via Linux-f2fs-devel
  2020-06-28  2:56 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Song via Linux-f2fs-devel @ 2020-06-26 14:39 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: liu.song11, linux-kernel, linux-f2fs-devel

From: Liu Song <liu.song11@zte.com.cn>

The value of state must be equal to FREE_NID, so the if
condition judgment can be removed.

Signed-off-by: Liu Song <liu.song11@zte.com.cn>
---
 fs/f2fs/node.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 03e24df1c84f..0adeb20f19c9 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2118,8 +2118,7 @@ static int __insert_free_nid(struct f2fs_sb_info *sbi,
 
 	f2fs_bug_on(sbi, state != i->state);
 	nm_i->nid_cnt[state]++;
-	if (state == FREE_NID)
-		list_add_tail(&i->list, &nm_i->free_nid_list);
+	list_add_tail(&i->list, &nm_i->free_nid_list);
 	return 0;
 }
 
-- 
2.20.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: remove unnecessary judgments in __insert_free_nid()
  2020-06-26 14:39 [f2fs-dev] [PATCH] f2fs: remove unnecessary judgments in __insert_free_nid() Liu Song via Linux-f2fs-devel
@ 2020-06-28  2:56 ` Chao Yu
  2020-06-28 12:30   ` fishland via Linux-f2fs-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2020-06-28  2:56 UTC (permalink / raw)
  To: Liu Song, jaegeuk, chao; +Cc: linux-f2fs-devel, liu.song11, linux-kernel

On 2020/6/26 22:39, Liu Song via Linux-f2fs-devel wrote:
> From: Liu Song <liu.song11@zte.com.cn>
> 
> The value of state must be equal to FREE_NID, so the if
> condition judgment can be removed.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>
> ---
>  fs/f2fs/node.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 03e24df1c84f..0adeb20f19c9 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2118,8 +2118,7 @@ static int __insert_free_nid(struct f2fs_sb_info *sbi,
>  
>  	f2fs_bug_on(sbi, state != i->state);
>  	nm_i->nid_cnt[state]++;
> -	if (state == FREE_NID)
> -		list_add_tail(&i->list, &nm_i->free_nid_list);
> +	list_add_tail(&i->list, &nm_i->free_nid_list);

In previous design, @state allow accepting both FREE_NID and PREALLOC_NID,
If you remove that condition, it's not correct to add free nid entry into
free_nid_list when passing PREALLOC_NID in @state, now, we only pass @state
with FREE_NID, so it's better to remove that parameter directly.

Thanks,

>  	return 0;
>  }
>  
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev]  [PATCH] f2fs: remove unnecessary judgments in __insert_free_nid()
  2020-06-28  2:56 ` Chao Yu
@ 2020-06-28 12:30   ` fishland via Linux-f2fs-devel
  0 siblings, 0 replies; 3+ messages in thread
From: fishland via Linux-f2fs-devel @ 2020-06-28 12:30 UTC (permalink / raw)
  To: Chao Yu, jaegeuk, chao; +Cc: linux-f2fs-devel, liu.song11, linux-kernel

>On 2020/6/26 22:39, Liu Song via Linux-f2fs-devel wrote:
>> From: Liu Song <liu.song11@zte.com.cn>
>> 
>> The value of state must be equal to FREE_NID, so the if
>> condition judgment can be removed.
>> 
>> Signed-off-by: Liu Song <liu.song11@zte.com.cn>
>> ---
>>  fs/f2fs/node.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 03e24df1c84f..0adeb20f19c9 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -2118,8 +2118,7 @@ static int __insert_free_nid(struct f2fs_sb_info *sbi,
>>  
>>   f2fs_bug_on(sbi, state != i->state);
>>   nm_i->nid_cnt[state]++;
>> - if (state == FREE_NID)
>> -  list_add_tail(&i->list, &nm_i->free_nid_list);
>> + list_add_tail(&i->list, &nm_i->free_nid_list);
>
>In previous design, @state allow accepting both FREE_NID and PREALLOC_NID,
>If you remove that condition, it's not correct to add free nid entry into
>free_nid_list when passing PREALLOC_NID in @state, now, we only pass @state
>with FREE_NID, so it's better to remove that parameter directly.
>
>Thanks,
>
>>   return 0;
>>  }
>>  
>>

Thanks for your suggestions, I will resubmit a patch as suggested.

Thanks

Liu Song


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2020-06-28 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 14:39 [f2fs-dev] [PATCH] f2fs: remove unnecessary judgments in __insert_free_nid() Liu Song via Linux-f2fs-devel
2020-06-28  2:56 ` Chao Yu
2020-06-28 12:30   ` fishland via Linux-f2fs-devel

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