Skip to contentSkip to conversation

f2fs: keep scanning until enough free nids are acquired

PATCH In review Fan Li 3 participants 4 messages Nov 7, 2017 1 message not in the archive F2FS file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20171107030535epcas1p2094e05ca25eecd2140518cab7a39723d@epcas1p2.samsung.com

Fan Li

author
#1 lore raw

PATCH 1/1 f2fs: keep scanning until enough free nids are acquired

In current version, after scan_free_nid_bits, the scan is over if nid_cnt[FREE_NID] != 0. In most cases, there are still free nids in the free list during the scan, and scan_free_nid_bits usually can't increase nid_cnt[FREE_NID].
It causes that __build_free_nids is called many times without solving the shortage of the free nids. This patch fixes that.

---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -1
index 3d0d1be..5cef118 100644
@@ -2010,7 +2010,7 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
                /* try to find free nids in free_nid_bitmap */
                scan_free_nid_bits(sbi);
 
-               if (nm_i->nid_cnt[FREE_NID])
+               if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
                        return;
        }
 

--
2.7.4

maintainer
#2 lore raw

Hi,

I merged this patch after fixing some broken format. Could you please check your email configuration?

Thanks,

Quoted 26 lines · Fan Li

In current version, after scan_free_nid_bits, the scan is over if nid_cnt[FREE_NID] != 0. In most cases, there are still free nids in the free list during the scan, and scan_free_nid_bits usually can't increase nid_cnt[FREE_NID].
It causes that __build_free_nids is called many times without solving the shortage of the free nids. This patch fixes that.

---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -2
index 3d0d1be..5cef118 100644
@@ -2010,7 +2010,7 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
                /* try to find free nids in free_nid_bitmap */
                scan_free_nid_bits(sbi);
 
-               if (nm_i->nid_cnt[FREE_NID])
+               if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
                        return;
        }
 
--

2.7.4

author
#3 lore raw
Quoted 9 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, November 07, 2017 11:41 AM
To: Fan Li
Cc: 'Chao Yu'; 'Chao Yu'; [email protected]; [email protected]
Subject: Re: [f2fs-dev] [PATCH] f2fs: keep scanning until enough free nids are acquired

Quoted 6 lines

Hi,

I merged this patch after fixing some broken format. Could you please check your email configuration?

Thanks,

Sorry to bother you with so trivial problem, mail configuration is fine, but I use a wrong way to copy the text this time, won't happen again.

Quoted 27 lines · Fan Li
Quoted 26 lines

In current version, after scan_free_nid_bits, the scan is over if nid_cnt[FREE_NID] != 0. In most cases, there are still free nids in the free list during the
scan, and scan_free_nid_bits usually can't increase nid_cnt[FREE_NID].
It causes that __build_free_nids is called many times without solving
the shortage of the free nids. This patch fixes that.

---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c index 3d0d1be..5cef118 renamed from fs/f2fs/node.c +0 -0

100644

fs/f2fs/node.c +1 -2
@@ -2010,7 +2010,7 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
                /* try to find free nids in free_nid_bitmap */
                scan_free_nid_bits(sbi);
 
-               if (nm_i->nid_cnt[FREE_NID])
+               if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
                        return;
        }
 
--

2.7.4

Reviewed-by on v1 1/1
#4 lore raw
In reply to Fan Li
Quoted 7 lines · Fan Li

In current version, after scan_free_nid_bits, the scan is over if nid_cnt[FREE_NID] != 0. In most cases, there are still free nids in the free list during the scan, and scan_free_nid_bits usually can't increase nid_cnt[FREE_NID].
It causes that __build_free_nids is called many times without solving the shortage of the free nids. This patch fixes that.

Thanks,

Quoted 22 lines
---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -2
index 3d0d1be..5cef118 100644
@@ -2010,7 +2010,7 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
                /* try to find free nids in free_nid_bitmap */
                scan_free_nid_bits(sbi);
 
-               if (nm_i->nid_cnt[FREE_NID])
+               if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
                        return;
        }
 
--

2.7.4