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


Groups > linux.kernel > #1301329

[PATCH 1/2] f2fs: check node id earily when readahead NAT page

From Chao Yu <chao2.yu@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] f2fs: check node id earily when readahead NAT page
Date 2016-01-05 10:00 +0100
Message-ID <qNvDb-84L-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Add node id check in ra_node_page and get_node_page_ra like get_node_page.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/node.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 6d5f548..c1ddf3d 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1041,6 +1041,10 @@ void ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
 	struct page *apage;
 	int err;
 
+	if (!nid)
+		return;
+	f2fs_bug_on(sbi, check_nid_range(sbi, nid));
+
 	apage = find_get_page(NODE_MAPPING(sbi), nid);
 	if (apage && PageUptodate(apage)) {
 		f2fs_put_page(apage, 0);
@@ -1108,6 +1112,7 @@ struct page *get_node_page_ra(struct page *parent, int start)
 	nid = get_nid(parent, start, false);
 	if (!nid)
 		return ERR_PTR(-ENOENT);
+	f2fs_bug_on(sbi, check_nid_range(sbi, nid));
 repeat:
 	page = grab_cache_page(NODE_MAPPING(sbi), nid);
 	if (!page)
@@ -1127,9 +1132,9 @@ repeat:
 	end = start + MAX_RA_NODE;
 	end = min(end, NIDS_PER_BLOCK);
 	for (i = start + 1; i < end; i++) {
-		nid_t tnid = get_nid(parent, i, false);
-		if (!tnid)
-			continue;
+		nid_t tnid;
+
+		tnid = get_nid(parent, i, false);
 		ra_node_page(sbi, tnid);
 	}
 
-- 
2.6.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH 1/2] f2fs: check node id earily when readahead NAT page Chao Yu <chao2.yu@samsung.com> - 2016-01-05 10:00 +0100
  RE: [f2fs-dev] [PATCH 1/2] f2fs: check node id earily when readahead  NAT page Chao Yu <chao2.yu@samsung.com> - 2016-01-05 10:20 +0100

csiph-web