f2fs: account read IOs and use IO counts for is_idle
This patch adds issued read IO counts which is under block layer. Chao modified a bit, since: Below race can cause reversed reference on F2FS_RD_DATA, there is the same issue in f2fs_submit_page_bio(), fix them by relocate __submit_bio() and inc_page_count. Thread A Thread B - f2fs_write_begin - f2fs_submit_page_read - __submit_bio - f2fs_read_end_io - __read_end_io - dec_page_count(, F2FS_RD_DATA) - inc_page_count(, F2FS_RD_DATA) Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Šī revīzija ir iekļauta:
@@ -950,6 +950,9 @@ enum count_type {
|
||||
F2FS_DIRTY_IMETA,
|
||||
F2FS_WB_CP_DATA,
|
||||
F2FS_WB_DATA,
|
||||
F2FS_RD_DATA,
|
||||
F2FS_RD_NODE,
|
||||
F2FS_RD_META,
|
||||
NR_COUNT_TYPE,
|
||||
};
|
||||
|
||||
@@ -1392,11 +1395,6 @@ static inline unsigned int f2fs_time_to_wait(struct f2fs_sb_info *sbi,
|
||||
return wait_ms;
|
||||
}
|
||||
|
||||
static inline bool is_idle(struct f2fs_sb_info *sbi, int type)
|
||||
{
|
||||
return f2fs_time_over(sbi, type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Inline functions
|
||||
*/
|
||||
@@ -1787,7 +1785,9 @@ static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
|
||||
atomic_inc(&sbi->nr_pages[count_type]);
|
||||
|
||||
if (count_type == F2FS_DIRTY_DATA || count_type == F2FS_INMEM_PAGES ||
|
||||
count_type == F2FS_WB_CP_DATA || count_type == F2FS_WB_DATA)
|
||||
count_type == F2FS_WB_CP_DATA || count_type == F2FS_WB_DATA ||
|
||||
count_type == F2FS_RD_DATA || count_type == F2FS_RD_NODE ||
|
||||
count_type == F2FS_RD_META)
|
||||
return;
|
||||
|
||||
set_sbi_flag(sbi, SBI_IS_DIRTY);
|
||||
@@ -2124,6 +2124,15 @@ static inline struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi,
|
||||
return bio_alloc(GFP_KERNEL, npages);
|
||||
}
|
||||
|
||||
static inline bool is_idle(struct f2fs_sb_info *sbi, int type)
|
||||
{
|
||||
if (get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_RD_NODE) ||
|
||||
get_pages(sbi, F2FS_RD_META) || get_pages(sbi, F2FS_WB_DATA) ||
|
||||
get_pages(sbi, F2FS_WB_CP_DATA))
|
||||
return false;
|
||||
return f2fs_time_over(sbi, type);
|
||||
}
|
||||
|
||||
static inline void f2fs_radix_tree_insert(struct radix_tree_root *root,
|
||||
unsigned long index, void *item)
|
||||
{
|
||||
@@ -3114,6 +3123,7 @@ struct f2fs_stat_info {
|
||||
int free_nids, avail_nids, alloc_nids;
|
||||
int total_count, utilization;
|
||||
int bg_gc, nr_wb_cp_data, nr_wb_data;
|
||||
int nr_rd_data, nr_rd_node, nr_rd_meta;
|
||||
unsigned int io_skip_bggc, other_skip_bggc;
|
||||
int nr_flushing, nr_flushed, flush_list_empty;
|
||||
int nr_discarding, nr_discarded;
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user