diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-09-04 14:13:01 +0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-10 00:15:05 +0400 |
commit | 184a5cd2ce281f1207d72adb9ae18e416ca371db (patch) | |
tree | b91e2cfcf93adc065377908fa601659ca24fcefc /fs/f2fs/node.c | |
parent | d3a14afd5ed1970519a2d6ed59f4062ec3ba821f (diff) | |
download | linux-184a5cd2ce281f1207d72adb9ae18e416ca371db.tar.xz |
f2fs: refactor flush_sit_entries codes for reducing SIT writes
In commit aec71382c681 ("f2fs: refactor flush_nat_entries codes for reducing NAT
writes"), we descripte the issue as below:
"Although building NAT journal in cursum reduce the read/write work for NAT
block, but previous design leave us lower performance when write checkpoint
frequently for these cases:
1. if journal in cursum has already full, it's a bit of waste that we flush all
nat entries to page for persistence, but not to cache any entries.
2. if journal in cursum is not full, we fill nat entries to journal util
journal is full, then flush the left dirty entries to disk without merge
journaled entries, so these journaled entries may be flushed to disk at next
checkpoint but lost chance to flushed last time."
Actually, we have the same problem in using SIT journal area.
In this patch, firstly we will update sit journal with dirty entries as many as
possible. Secondly if there is no space in sit journal, we will remove all
entries in journal and walk through the whole dirty entry bitmap of sit,
accounting dirty sit entries located in same SIT block to sit entry set. All
entry sets are linked to list sit_entry_set in sm_info, sorted ascending order
by count of entries in set. Later we flush entries in set which have fewest
entries into journal as many as we can, and then flush dense set with merged
entries to disk.
In this way we can use sit journal area more effectively, also we will reduce
SIT update, result in gaining in performance and saving lifetime of flash
device.
In my testing environment, it shows this patch can help to reduce SIT block
update obviously.
virtual machine + hard disk:
fsstress -p 20 -n 400 -l 5
sit page num cp count sit pages/cp
based 2006.50 1349.75 1.486
patched 1566.25 1463.25 1.070
Our latency of merging op is small when handling a great number of dirty SIT
entries in flush_sit_entries:
latency(ns) dirty sit count
36038 2151
49168 2123
37174 2232
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 1af7879bfb75..b32eb565e6b3 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1798,14 +1798,6 @@ static void merge_nats_in_set(struct f2fs_sb_info *sbi) write_unlock(&nm_i->nat_tree_lock); } -static bool __has_cursum_space(struct f2fs_summary_block *sum, int size) -{ - if (nats_in_cursum(sum) + size <= NAT_JOURNAL_ENTRIES) - return true; - else - return false; -} - static void remove_nats_in_journal(struct f2fs_sb_info *sbi) { struct f2fs_nm_info *nm_i = NM_I(sbi); @@ -1860,7 +1852,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) * entries, remove all entries from journal and merge them * into nat entry set. */ - if (!__has_cursum_space(sum, nm_i->dirty_nat_cnt)) { + if (!__has_cursum_space(sum, nm_i->dirty_nat_cnt, NAT_JOURNAL)) { remove_nats_in_journal(sbi); /* @@ -1883,7 +1875,8 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) struct page *page; nid_t start_nid = nes->start_nid; - if (to_journal && !__has_cursum_space(sum, nes->entry_cnt)) + if (to_journal && + !__has_cursum_space(sum, nes->entry_cnt, NAT_JOURNAL)) to_journal = false; if (to_journal) { |