Commit c879f90d authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: move get_page for gc victims

This patch moves getting victim page into move_data_page.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 05ca3632
...@@ -518,14 +518,13 @@ static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, ...@@ -518,14 +518,13 @@ static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
return 1; return 1;
} }
static void move_data_page(struct inode *inode, struct page *page, int gc_type) static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
{ {
struct f2fs_io_info fio = { struct page *page;
.sbi = F2FS_I_SB(inode),
.type = DATA, page = get_lock_data_page(inode, bidx);
.rw = WRITE_SYNC, if (IS_ERR(page))
.page = page, return;
};
if (gc_type == BG_GC) { if (gc_type == BG_GC) {
if (PageWriteback(page)) if (PageWriteback(page))
...@@ -533,6 +532,12 @@ static void move_data_page(struct inode *inode, struct page *page, int gc_type) ...@@ -533,6 +532,12 @@ static void move_data_page(struct inode *inode, struct page *page, int gc_type)
set_page_dirty(page); set_page_dirty(page);
set_cold_data(page); set_cold_data(page);
} else { } else {
struct f2fs_io_info fio = {
.sbi = F2FS_I_SB(inode),
.type = DATA,
.rw = WRITE_SYNC,
.page = page,
};
f2fs_wait_on_page_writeback(page, DATA); f2fs_wait_on_page_writeback(page, DATA);
if (clear_page_dirty_for_io(page)) if (clear_page_dirty_for_io(page))
...@@ -618,12 +623,9 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, ...@@ -618,12 +623,9 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
/* phase 3 */ /* phase 3 */
inode = find_gc_inode(gc_list, dni.ino); inode = find_gc_inode(gc_list, dni.ino);
if (inode) { if (inode) {
start_bidx = start_bidx_of_node(nofs, F2FS_I(inode)); start_bidx = start_bidx_of_node(nofs, F2FS_I(inode))
data_page = get_lock_data_page(inode, + ofs_in_node;
start_bidx + ofs_in_node); move_data_page(inode, start_bidx, gc_type);
if (IS_ERR(data_page))
continue;
move_data_page(inode, data_page, gc_type);
stat_inc_data_blk_count(sbi, 1, gc_type); stat_inc_data_blk_count(sbi, 1, gc_type);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment