From: Yunlei He <heyunlei@huawei.com>
To: jaegeuk@kernel.org, yuchao0@huawei.com,
linux-f2fs-devel@lists.sourceforge.net
Cc: zhangdianfang@huawei.com
Subject: [PATCH] f2fs: allow ssa journal with nat bits enabled
Date: Wed, 25 Apr 2018 15:56:55 +0800 [thread overview]
Message-ID: <1524643015-13256-1-git-send-email-heyunlei@huawei.com> (raw)
This patch enable ssa journal with nat bits, which is
benifit for nat metadata write.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/node.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 681552b..220110a 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -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,
--
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
next reply other threads:[~2018-04-25 8:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 7:56 Yunlei He [this message]
2018-04-25 13:21 ` [PATCH] f2fs: allow ssa journal with nat bits enabled Chao Yu
2018-05-04 8:27 ` heyunlei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524643015-13256-1-git-send-email-heyunlei@huawei.com \
--to=heyunlei@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
--cc=zhangdianfang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).