f2fs: allow ssa journal with nat bits enabled
PATCH 1/1 f2fs: allow ssa journal with nat bits enabled
This patch enable ssa journal with nat bits, which is benifit for nat metadata write.
--- fs/f2fs/node.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
fs/f2fs/node.c +10 -6
@@ -2446,7 +2446,7 @@ static void __adjust_nat_entry_set(struct nat_entry_set *nes, }static void __update_nat_bits (struct f2fs_sb_info *sbi,nid_t start_nid, -struct page *page) +struct page *page,bool to_journal) {struct f2fs_nm_info *nm_i =NM_I (sbi);unsigned int nat_index = start_nid /NAT_ENTRY_PER_BLOCK ;
@@ -2457,6 +2457,12 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,if (!enabled_nat_bits (sbi,NULL ))return ; +if (to_journal) { +__clear_bit_le (nat_index, nm_i->full_nat_bits); +__clear_bit_le (nat_index, nm_i->empty_nat_bits); +return ; + } +if (nat_index ==0 ) { valid =1 ; i =1 ;
@@ -2494,8 +2500,7 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,* #1, flush nat entries to journal in current hot data summary block. * #2, flush nat entries to nat page. */ -if (enabled_nat_bits (sbi, cpc) || - !__has_cursum_space (journal, set->entry_cnt,NAT_JOURNAL )) +if (!__has_cursum_space (journal, set->entry_cnt,NAT_JOURNAL )) to_journal = false;if (to_journal) {
@@ -2535,11 +2540,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, } } +__update_nat_bits (sbi, start_nid, page, to_journal);if (to_journal) {up_write (&curseg->journal_rwsem); }else {scan_nat_page (sbi, page, start_nid, false); -__update_nat_bits (sbi, start_nid, page);f2fs_put_page (page,1 ); }
@@ -2574,8 +2579,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)* entries, remove all entries from journal and merge them * into nat entry set. */ -if (enabled_nat_bits (sbi, cpc) || - !__has_cursum_space (journal, nm_i->dirty_nat_cnt,NAT_JOURNAL )) +if (!__has_cursum_space (journal, nm_i->dirty_nat_cnt,NAT_JOURNAL ))remove_nats_in_journal (sbi); while ((found = __gang_lookup_nat_set(nm_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
Quoted 4 lines · Yunlei He
This patch enable ssa journal with nat bits, which is benifit for nat metadata write.
Signed-off-by Yunlei He <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Ping
Thanks
Quoted 75 lines
-----Original Message-----
From: heyunlei
Sent: Wednesday, April 25, 2018 3:57 PM
To: [email protected]; Yuchao (T); [email protected]
Cc: Wangbintian; heyunlei; Zhangdianfang (Euler)
Subject: [f2fs-dev][PATCH] f2fs: allow ssa journal with nat bits enabledThis patch enable ssa journal with nat bits, which is benifit for nat metadata write.
Signed-off-by Yunlei He <[email protected]>---
fs/f2fs/node.c| 16 ++++++++++------1 file changed, 10 insertions(+), 6 deletions(-)fs/f2fs/node.c +10
-7@@ -2446,7 +2446,7 @@ static void __adjust_nat_entry_set(struct nat_entry_set *nes, }static void __update_nat_bits (struct f2fs_sb_info *sbi,nid_t start_nid, -struct page *page) +struct page *page,bool to_journal) {struct f2fs_nm_info *nm_i =NM_I (sbi);unsigned int nat_index = start_nid /NAT_ENTRY_PER_BLOCK ;@@ -2457,6 +2457,12 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid,if (!enabled_nat_bits (sbi,NULL ))return ; +if (to_journal) { +__clear_bit_le (nat_index, nm_i->full_nat_bits); +__clear_bit_le (nat_index, nm_i->empty_nat_bits); +return ; + } +if (nat_index ==0 ) { valid =1 ; i =1 ;@@ -2494,8 +2500,7 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,* #1, flush nat entries to journal in current hot data summary block. * #2, flush nat entries to nat page. */ -if (enabled_nat_bits (sbi, cpc) || - !__has_cursum_space (journal, set->entry_cnt,NAT_JOURNAL )) +if (!__has_cursum_space (journal, set->entry_cnt,NAT_JOURNAL )) to_journal = false;if (to_journal) {@@ -2535,11 +2540,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, } } +__update_nat_bits (sbi, start_nid, page, to_journal);if (to_journal) {up_write (&curseg->journal_rwsem); }else {scan_nat_page (sbi, page, start_nid, false); -__update_nat_bits (sbi, start_nid, page);f2fs_put_page (page,1 ); }@@ -2574,8 +2579,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)* entries, remove all entries from journal and merge them * into nat entry set. */ -if (enabled_nat_bits (sbi, cpc) || - !__has_cursum_space (journal, nm_i->dirty_nat_cnt,NAT_JOURNAL )) +if (!__has_cursum_space (journal, nm_i->dirty_nat_cnt,NAT_JOURNAL ))remove_nats_in_journal (sbi); while ((found = __gang_lookup_nat_set(nm_i, --
Quoted 1 line
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