aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-02-25 23:10:46 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-03-18 08:00:33 -0400
commit266e97a81cf73d1a0dac5f68391da382630a80b7 (patch)
treee5c335396c512c72d5c324f789a8ddae93340b0c /fs/f2fs/node.c
parent66d36a2944df461448159be5af13049dd2689e77 (diff)
f2fs: introduce readahead mode of node pages
Previously, f2fs reads several node pages ahead when get_dnode_of_data is called with RDONLY_NODE flag. And, this flag is set by the following functions. - get_data_block_ro - get_lock_data_page - do_write_data_page - truncate_blocks - truncate_hole However, this readahead mechanism is initially introduced for the use of get_data_block_ro to enhance the sequential read performance. So, let's clarify all the cases with the additional modes as follows. enum { ALLOC_NODE, /* allocate a new node page if needed */ LOOKUP_NODE, /* look up a node without readahead */ LOOKUP_NODE_RA, /* * look up a node with readahead called * by get_datablock_ro. */ } Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index efcada7becd5..65ec2eabb392 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -384,7 +384,7 @@ got:
384/* 384/*
385 * Caller should call f2fs_put_dnode(dn). 385 * Caller should call f2fs_put_dnode(dn).
386 */ 386 */
387int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int ro) 387int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
388{ 388{
389 struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb); 389 struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
390 struct page *npage[4]; 390 struct page *npage[4];
@@ -411,7 +411,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int ro)
411 for (i = 1; i <= level; i++) { 411 for (i = 1; i <= level; i++) {
412 bool done = false; 412 bool done = false;
413 413
414 if (!nids[i] && !ro) { 414 if (!nids[i] && mode == ALLOC_NODE) {
415 mutex_lock_op(sbi, NODE_NEW); 415 mutex_lock_op(sbi, NODE_NEW);
416 416
417 /* alloc new node */ 417 /* alloc new node */
@@ -434,7 +434,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int ro)
434 alloc_nid_done(sbi, nids[i]); 434 alloc_nid_done(sbi, nids[i]);
435 mutex_unlock_op(sbi, NODE_NEW); 435 mutex_unlock_op(sbi, NODE_NEW);
436 done = true; 436 done = true;
437 } else if (ro && i == level && level > 1) { 437 } else if (mode == LOOKUP_NODE_RA && i == level && level > 1) {
438 npage[i] = get_node_page_ra(parent, offset[i - 1]); 438 npage[i] = get_node_page_ra(parent, offset[i - 1]);
439 if (IS_ERR(npage[i])) { 439 if (IS_ERR(npage[i])) {
440 err = PTR_ERR(npage[i]); 440 err = PTR_ERR(npage[i]);