f2fs: remove unnecessary judgments in __insert_free_nid()
PATCH 1/1 f2fs: remove unnecessary judgments in __insert_free_nid()
From: Liu Song <[email protected]>
The value of state must be equal to FREE_NID, so the if condition judgment can be removed.
--- fs/f2fs/node.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/node.c +1 -2
@@ -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 ; }
Signature · 8 lines
2.20.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 15 lines · On 2020/6/26 22:39, Liu Song via Linux-f2fs-devel wrote:
From: Liu Song <[email protected]>
The value of state must be equal to
FREE_NID, so the if condition judgment can be removed.Signed-off-by Liu Song <[email protected]>--- fs/f2fs/node.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/node.c +0
-0
fs/f2fs/node.c static int __insert_free_nid(struct f2fs_sb_info *sbi, · line 2121
Quoted 6 lines
fs/f2fs/node.c +1
-2@@ -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,
Quoted 4 lines
fs/f2fs/node.c +0
-0return 0 ; }
Quoted 28 lines · On 2020/6/26 22:39, Liu Song via Linux-f2fs-devel wrote:
Quoted 15 lines
From: Liu Song <[email protected]>
The value of state must be equal to
FREE_NID, so the if condition judgment can be removed.Signed-off-by Liu Song <[email protected]>--- fs/f2fs/node.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/f2fs/node.c +0
-0fs/f2fs/node.c static int __insert_free_nid(struct f2fs_sb_info *sbi, · line 2121
Quoted 6 lines
fs/f2fs/node.c +1
-2@@ -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_NIDandPREALLOC_NID, If you remove that condition, it's not correct to add free nid entry intofree_nid_listwhen passingPREALLOC_NIDin @state, now, we only pass @state withFREE_NID, so it's better to remove that parameter directly.
Quoted 6 lines
Thanks,
Quoted 4 lines
fs/f2fs/node.c +0
-0return 0 ; }
Thanks for your suggestions, I will resubmit a patch as suggested.
Thanks
Liu Song
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel