Commit 81377bd6 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: use fio instead of multiple parameters

This patch just changes using fio instead of parameters.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent b9109b0e
...@@ -2039,61 +2039,62 @@ static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type) ...@@ -2039,61 +2039,62 @@ static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type)
return false; return false;
} }
static int __get_segment_type_2(struct page *page, enum page_type p_type) static int __get_segment_type_2(struct f2fs_io_info *fio)
{ {
if (p_type == DATA) if (fio->type == DATA)
return CURSEG_HOT_DATA; return CURSEG_HOT_DATA;
else else
return CURSEG_HOT_NODE; return CURSEG_HOT_NODE;
} }
static int __get_segment_type_4(struct page *page, enum page_type p_type) static int __get_segment_type_4(struct f2fs_io_info *fio)
{ {
if (p_type == DATA) { if (fio->type == DATA) {
struct inode *inode = page->mapping->host; struct inode *inode = fio->page->mapping->host;
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
return CURSEG_HOT_DATA; return CURSEG_HOT_DATA;
else else
return CURSEG_COLD_DATA; return CURSEG_COLD_DATA;
} else { } else {
if (IS_DNODE(page) && is_cold_node(page)) if (IS_DNODE(fio->page) && is_cold_node(fio->page))
return CURSEG_WARM_NODE; return CURSEG_WARM_NODE;
else else
return CURSEG_COLD_NODE; return CURSEG_COLD_NODE;
} }
} }
static int __get_segment_type_6(struct page *page, enum page_type p_type) static int __get_segment_type_6(struct f2fs_io_info *fio)
{ {
if (p_type == DATA) { if (fio->type == DATA) {
struct inode *inode = page->mapping->host; struct inode *inode = fio->page->mapping->host;
if (is_cold_data(page) || file_is_cold(inode)) if (is_cold_data(fio->page) || file_is_cold(inode))
return CURSEG_COLD_DATA; return CURSEG_COLD_DATA;
if (is_inode_flag_set(inode, FI_HOT_DATA)) if (is_inode_flag_set(inode, FI_HOT_DATA))
return CURSEG_HOT_DATA; return CURSEG_HOT_DATA;
return CURSEG_WARM_DATA; return CURSEG_WARM_DATA;
} else { } else {
if (IS_DNODE(page)) if (IS_DNODE(fio->page))
return is_cold_node(page) ? CURSEG_WARM_NODE : return is_cold_node(fio->page) ? CURSEG_WARM_NODE :
CURSEG_HOT_NODE; CURSEG_HOT_NODE;
return CURSEG_COLD_NODE; return CURSEG_COLD_NODE;
} }
} }
static int __get_segment_type(struct page *page, enum page_type p_type) static int __get_segment_type(struct f2fs_io_info *fio)
{ {
switch (F2FS_P_SB(page)->active_logs) { switch (fio->sbi->active_logs) {
case 2: case 2:
return __get_segment_type_2(page, p_type); return __get_segment_type_2(fio);
case 4: case 4:
return __get_segment_type_4(page, p_type); return __get_segment_type_4(fio);
} }
/* NR_CURSEG_TYPE(6) logs by default */ /* NR_CURSEG_TYPE(6) logs by default */
f2fs_bug_on(F2FS_P_SB(page), f2fs_bug_on(fio->sbi, fio->sbi->active_logs != NR_CURSEG_TYPE);
F2FS_P_SB(page)->active_logs != NR_CURSEG_TYPE);
return __get_segment_type_6(page, p_type); return __get_segment_type_6(fio);
} }
void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
...@@ -2139,7 +2140,7 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, ...@@ -2139,7 +2140,7 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
{ {
int type = __get_segment_type(fio->page, fio->type); int type = __get_segment_type(fio);
int err; int err;
if (fio->type == NODE || fio->type == DATA) if (fio->type == NODE || fio->type == DATA)
......
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