linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: remove unneed reada during build free nids
@ 2018-02-09  3:58 Yunlei He
  2018-02-09 13:36 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2018-02-09  3:58 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: heyunlei

This patch remove unneed reada during build free nids.
If few nids left, three will introduce a lot of no hit
read io.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/node.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 833b46b..ad28965 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2033,10 +2033,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
 			return;
 	}
 
-	/* readahead nat pages to be scanned */
-	ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nid), FREE_NID_PAGES,
-							META_NAT, true);
-
 	down_read(&nm_i->nat_tree_lock);
 
 	while (1) {
@@ -2052,7 +2048,12 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
 		if (unlikely(nid >= nm_i->max_nid))
 			nid = 0;
 
-		if (++i >= FREE_NID_PAGES)
+		/* bg build, no more than 8 pages */
+		if ((!sync || mount) && ++i >= FREE_NID_PAGES)
+			break;
+
+		/* fg build, until free nids is not zero */
+		if (sync && !mount && nm_i->nid_cnt[FREE_NID])
 			break;
 	}
 
@@ -2063,9 +2064,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
 	scan_curseg_cache(sbi);
 
 	up_read(&nm_i->nat_tree_lock);
-
-	ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nm_i->next_scan_nid),
-					nm_i->ra_nid_pages, META_NAT, false);
 }
 
 void build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
-- 
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-11  3:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09  3:58 [PATCH] f2fs: remove unneed reada during build free nids Yunlei He
2018-02-09 13:36 ` Chao Yu
2018-02-11  1:55   ` heyunlei
2018-02-11  3:12     ` Chao Yu

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).