Skip to contentSkip to conversation

f2fs: no need to scan nat bitmap if it's not enable

PATCH In review Yunlei He 2 participants 4 messages Sep 7, 2017 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: no need to scan nat bitmap if it's not enable

Now, nat bitmap will get lost after sudden power off, when we build free nids, it's better to judge nat bitmap enable or not before scan nat bitmap.

---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/node.c +3 -0
index fca8783..482f424 100644
@@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
 
+	if (!enabled_nat_bits(sbi, NULL))
+		return;
+
 	down_read(&nm_i->nat_tree_lock);
 
 	for (i = 0; i < nm_i->nat_blocks; i++) {
Signature · 6 lines
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
#1 lore raw
Quoted 3 lines · Yunlei He

Now, nat bitmap will get lost after sudden power off, when we build free nids, it's better to judge nat bitmap enable or not before scan nat bitmap.

We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there any problem here?

Thanks,

Quoted 12 lines
---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/node.c +0 -0
index fca8783..482f424 100644

fs/f2fs/node.c static void scan_free_nid_bits(struct f2fs_sb_info *sbi) · line 1945

Quoted 9 lines
fs/f2fs/node.c +3 -0
@@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
 
+	if (!enabled_nat_bits(sbi, NULL))
+		return;
+
 	down_read(&nm_i->nat_tree_lock);
 
 	for (i = 0; i < nm_i->nat_blocks; i++) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#2 lore raw

Hi Chao,

Quoted 3 lines · Yunlei He

Now, nat bitmap will get lost after sudden power off, when we build free nids, it's better to judge nat bitmap enable or not before scan nat bitmap.

We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there any problem here?

Thanks,

We write nat bits only when CP_UMOUNT is set, is something else I missing?

Thanks,

Quoted 12 lines
---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/node.c index fca8783..482f424 renamed from fs/f2fs/node.c +0 -0

100644

fs/f2fs/node.c static void scan_free_nid_bits(struct f2fs_sb_info *sbi) · line 1945

Quoted 9 lines
fs/f2fs/node.c +3 -0
@@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
 
+	if (!enabled_nat_bits(sbi, NULL))
+		return;
+
 	down_read(&nm_i->nat_tree_lock);
 
 	for (i = 0; i < nm_i->nat_blocks; i++) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw

Hi Yunlei,

Quoted 11 lines · heyunlei

Hi Chao,

Quoted 3 lines · Yunlei He

Now, nat bitmap will get lost after sudden power off, when we build free nids, it's better to judge nat bitmap enable or not before scan nat bitmap.

We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there any problem here?

Thanks,

We write nat bits only when CP_UMOUNT is set, is something else I missing?

Yup, if nat_bits map is out of update, we have already skipped loading it in load_free_nid_bitmap.

You're trying to shut down free nide bitmap cache which is just pure intermediate cache, the cache will be initialized with nat_bits map and be updated during free nid allocation/releasing, for SPOR case, we will skip initialization step, but still the cache can run well due to other updating mechanism. So I don't think we have to disable the cache for that case.

Below patches can help you understand well about history and implementation of the cache, please check them:

f2fs: add bitmaps for empty or full NAT blocks
f2fs: introduce free nid bitmap
f2fs: combine nat_bits and free_nid_bitmap cache

Thanks,

Quoted 17 lines

Thanks,

Quoted 14 lines
---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/node.c index fca8783..482f424 renamed from fs/f2fs/node.c +0 -0

100644

fs/f2fs/node.c +0 -0
@@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
 
Quoted 8 lines

fs/f2fs/node.c static void scan_free_nid_bits(struct f2fs_sb_info *sbi) · line 1945

Quoted 7 lines
fs/f2fs/node.c +3 -0
+	if (!enabled_nat_bits(sbi, NULL))
+		return;
+
 	down_read(&nm_i->nat_tree_lock);
 
 	for (i = 0; i < nm_i->nat_blocks; i++) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel