diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-02-07 03:11:53 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-17 00:58:53 -0500 |
commit | 662befda25fb16d7164633c39e9e20aeac5107d9 (patch) | |
tree | 5c1b598aac5d326a0d524937584ee01ddcffa274 /fs/f2fs/node.c | |
parent | 3375f696bd9cfdfd385e2460a9cf021d8ef01eab (diff) |
f2fs: introduce ra_meta_pages to readahead CP/NAT/SIT pages
This patch help us to cleanup the readahead code by merging ra_{sit,nat}_pages
function into ra_meta_pages.
Additionally the new function is used to readahead cp block in
recover_orphan_inodes.
Change log from v1:
o fix a deadloop bug pointed by Jaegeuk Kim.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 82f4753ef418..7689f9105dc1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -82,42 +82,6 @@ static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid) | |||
82 | return dst_page; | 82 | return dst_page; |
83 | } | 83 | } |
84 | 84 | ||
85 | /* | ||
86 | * Readahead NAT pages | ||
87 | */ | ||
88 | static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid) | ||
89 | { | ||
90 | struct address_space *mapping = META_MAPPING(sbi); | ||
91 | struct f2fs_nm_info *nm_i = NM_I(sbi); | ||
92 | struct page *page; | ||
93 | pgoff_t index; | ||
94 | int i; | ||
95 | struct f2fs_io_info fio = { | ||
96 | .type = META, | ||
97 | .rw = READ_SYNC | REQ_META | REQ_PRIO | ||
98 | }; | ||
99 | |||
100 | |||
101 | for (i = 0; i < FREE_NID_PAGES; i++, nid += NAT_ENTRY_PER_BLOCK) { | ||
102 | if (unlikely(nid >= nm_i->max_nid)) | ||
103 | nid = 0; | ||
104 | index = current_nat_addr(sbi, nid); | ||
105 | |||
106 | page = grab_cache_page(mapping, index); | ||
107 | if (!page) | ||
108 | continue; | ||
109 | if (PageUptodate(page)) { | ||
110 | mark_page_accessed(page); | ||
111 | f2fs_put_page(page, 1); | ||
112 | continue; | ||
113 | } | ||
114 | f2fs_submit_page_mbio(sbi, page, index, &fio); | ||
115 | mark_page_accessed(page); | ||
116 | f2fs_put_page(page, 0); | ||
117 | } | ||
118 | f2fs_submit_merged_bio(sbi, META, READ); | ||
119 | } | ||
120 | |||
121 | static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n) | 85 | static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n) |
122 | { | 86 | { |
123 | return radix_tree_lookup(&nm_i->nat_root, n); | 87 | return radix_tree_lookup(&nm_i->nat_root, n); |
@@ -1413,7 +1377,7 @@ static void build_free_nids(struct f2fs_sb_info *sbi) | |||
1413 | return; | 1377 | return; |
1414 | 1378 | ||
1415 | /* readahead nat pages to be scanned */ | 1379 | /* readahead nat pages to be scanned */ |
1416 | ra_nat_pages(sbi, nid); | 1380 | ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nid), FREE_NID_PAGES, META_NAT); |
1417 | 1381 | ||
1418 | while (1) { | 1382 | while (1) { |
1419 | struct page *page = get_current_nat_page(sbi, nid); | 1383 | struct page *page = get_current_nat_page(sbi, nid); |