Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1657497

[PATCH 3/4] f2fs: don't track newly allocated nat entry in list

From Chao Yu <yuchao0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 3/4] f2fs: don't track newly allocated nat entry in list
Date 2017-06-05 12:40 +0200
Message-ID <tOXAv-1HK-29@gated-at.bofh.it> (permalink)
References <tOXAu-1HK-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We will never persist newly allocated nat entries during checkpoint(), so
we don't need to track such nat entries in nat dirty list in order to
avoid:
- more latency during traversing dirty list;
- sorting nat sets incorrectly due to recording wrong entry_cnt in nat
entry set.

Signed-off-by: Chao Yu <yuchao0@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 d22db8ce0a69..05700e54f91e 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -158,9 +158,6 @@ static void __set_nat_cache_dirty(struct f2fs_nm_info *nm_i,
 	nid_t set = NAT_BLOCK_OFFSET(ne->ni.nid);
 	struct nat_entry_set *head;
 
-	if (get_nat_flag(ne, IS_DIRTY))
-		return;
-
 	head = radix_tree_lookup(&nm_i->nat_set_root, set);
 	if (!head) {
 		head = f2fs_kmem_cache_alloc(nat_entry_set_slab, GFP_NOFS);
@@ -171,10 +168,18 @@ static void __set_nat_cache_dirty(struct f2fs_nm_info *nm_i,
 		head->entry_cnt = 0;
 		f2fs_radix_tree_insert(&nm_i->nat_set_root, set, head);
 	}
-	list_move_tail(&ne->list, &head->entry_list);
+
+	if (get_nat_flag(ne, IS_DIRTY))
+		goto refresh_list;
+
 	nm_i->dirty_nat_cnt++;
 	head->entry_cnt++;
 	set_nat_flag(ne, IS_DIRTY, true);
+refresh_list:
+	if (nat_get_blkaddr(ne) == NEW_ADDR)
+		list_del_init(&ne->list);
+	else
+		list_move_tail(&ne->list, &head->entry_list);
 }
 
 static void __clear_nat_cache_dirty(struct f2fs_nm_info *nm_i,
@@ -2423,8 +2428,7 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
 		nid_t nid = nat_get_nid(ne);
 		int offset;
 
-		if (nat_get_blkaddr(ne) == NEW_ADDR)
-			continue;
+		f2fs_bug_on(sbi, nat_get_blkaddr(ne) == NEW_ADDR);
 
 		if (to_journal) {
 			offset = lookup_journal_in_cursum(journal,
-- 
2.13.0.67.g10c78a162fa8

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] f2fs: introduce __wait_one_discard_bio Chao Yu <yuchao0@huawei.com> - 2017-06-05 12:40 +0200
  [PATCH 4/4] f2fs: use bio_set_op_attrs Chao Yu <yuchao0@huawei.com> - 2017-06-05 12:40 +0200
    Re: [PATCH 4/4] f2fs: use bio_set_op_attrs Christoph Hellwig <hch@infradead.org> - 2017-06-05 12:50 +0200
      Re: [PATCH 4/4] f2fs: use bio_set_op_attrs Chao Yu <yuchao0@huawei.com> - 2017-06-05 13:10 +0200
  [PATCH 3/4] f2fs: don't track newly allocated nat entry in list Chao Yu <yuchao0@huawei.com> - 2017-06-05 12:40 +0200

csiph-web