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/segment.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/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index e87946a08a21..fbb41ba818fd 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -1576,47 +1576,6 @@ static int build_curseg(struct f2fs_sb_info *sbi) | |||
1576 | return restore_curseg_summaries(sbi); | 1576 | return restore_curseg_summaries(sbi); |
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | static int ra_sit_pages(struct f2fs_sb_info *sbi, int start, int nrpages) | ||
1580 | { | ||
1581 | struct address_space *mapping = META_MAPPING(sbi); | ||
1582 | struct page *page; | ||
1583 | block_t blk_addr, prev_blk_addr = 0; | ||
1584 | int sit_blk_cnt = SIT_BLK_CNT(sbi); | ||
1585 | int blkno = start; | ||
1586 | struct f2fs_io_info fio = { | ||
1587 | .type = META, | ||
1588 | .rw = READ_SYNC | REQ_META | REQ_PRIO | ||
1589 | }; | ||
1590 | |||
1591 | for (; blkno < start + nrpages && blkno < sit_blk_cnt; blkno++) { | ||
1592 | |||
1593 | blk_addr = current_sit_addr(sbi, blkno * SIT_ENTRY_PER_BLOCK); | ||
1594 | |||
1595 | if (blkno != start && prev_blk_addr + 1 != blk_addr) | ||
1596 | break; | ||
1597 | prev_blk_addr = blk_addr; | ||
1598 | repeat: | ||
1599 | page = grab_cache_page(mapping, blk_addr); | ||
1600 | if (!page) { | ||
1601 | cond_resched(); | ||
1602 | goto repeat; | ||
1603 | } | ||
1604 | if (PageUptodate(page)) { | ||
1605 | mark_page_accessed(page); | ||
1606 | f2fs_put_page(page, 1); | ||
1607 | continue; | ||
1608 | } | ||
1609 | |||
1610 | f2fs_submit_page_mbio(sbi, page, blk_addr, &fio); | ||
1611 | |||
1612 | mark_page_accessed(page); | ||
1613 | f2fs_put_page(page, 0); | ||
1614 | } | ||
1615 | |||
1616 | f2fs_submit_merged_bio(sbi, META, READ); | ||
1617 | return blkno - start; | ||
1618 | } | ||
1619 | |||
1620 | static void build_sit_entries(struct f2fs_sb_info *sbi) | 1579 | static void build_sit_entries(struct f2fs_sb_info *sbi) |
1621 | { | 1580 | { |
1622 | struct sit_info *sit_i = SIT_I(sbi); | 1581 | struct sit_info *sit_i = SIT_I(sbi); |
@@ -1628,7 +1587,7 @@ static void build_sit_entries(struct f2fs_sb_info *sbi) | |||
1628 | int nrpages = MAX_BIO_BLOCKS(max_hw_blocks(sbi)); | 1587 | int nrpages = MAX_BIO_BLOCKS(max_hw_blocks(sbi)); |
1629 | 1588 | ||
1630 | do { | 1589 | do { |
1631 | readed = ra_sit_pages(sbi, start_blk, nrpages); | 1590 | readed = ra_meta_pages(sbi, start_blk, nrpages, META_SIT); |
1632 | 1591 | ||
1633 | start = start_blk * sit_i->sents_per_block; | 1592 | start = start_blk * sit_i->sents_per_block; |
1634 | end = (start_blk + readed) * sit_i->sents_per_block; | 1593 | end = (start_blk + readed) * sit_i->sents_per_block; |