f2fs: use meta_inode cache to improve roll-forward speed

Previously, all the dnode pages should be read during the roll-forward recovery.
Even worsely, whole the chain was traversed twice.
This patch removes that redundant and costly read operations by using page cache
of meta_inode and readahead function as well.

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim
2014-09-11 13:49:55 -07:00
parent 60979115a6
commit 4c521f493b
4 changed files with 60 additions and 44 deletions

View File

@@ -72,7 +72,23 @@ out:
return page;
}
static inline int get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
struct page *get_meta_page_ra(struct f2fs_sb_info *sbi, pgoff_t index)
{
bool readahead = false;
struct page *page;
page = find_get_page(META_MAPPING(sbi), index);
if (!page || (page && !PageUptodate(page)))
readahead = true;
f2fs_put_page(page, 0);
if (readahead)
ra_meta_pages(sbi, index,
MAX_BIO_BLOCKS(max_hw_blocks(sbi)), META_POR);
return get_meta_page(sbi, index);
}
static inline block_t get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
{
switch (type) {
case META_NAT:
@@ -82,6 +98,8 @@ static inline int get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
case META_SSA:
case META_CP:
return 0;
case META_POR:
return SM_I(sbi)->seg0_blkaddr + TOTAL_BLKS(sbi);
default:
BUG();
}
@@ -90,12 +108,13 @@ static inline int get_max_meta_blks(struct f2fs_sb_info *sbi, int type)
/*
* Readahead CP/NAT/SIT/SSA pages
*/
int ra_meta_pages(struct f2fs_sb_info *sbi, int start, int nrpages, int type)
int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type)
{
block_t prev_blk_addr = 0;
struct page *page;
int blkno = start;
int max_blks = get_max_meta_blks(sbi, type);
block_t blkno = start;
block_t max_blks = get_max_meta_blks(sbi, type);
block_t min_blks = SM_I(sbi)->seg0_blkaddr;
struct f2fs_io_info fio = {
.type = META,
@@ -125,7 +144,11 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, int start, int nrpages, int type)
break;
case META_SSA:
case META_CP:
/* get ssa/cp block addr */
case META_POR:
if (unlikely(blkno >= max_blks))
goto out;
if (unlikely(blkno < min_blks))
goto out;
blk_addr = blkno;
break;
default: