diff options
-rw-r--r-- | fs/f2fs/data.c | 24 | ||||
-rw-r--r-- | fs/f2fs/debug.c | 7 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 22 |
3 files changed, 44 insertions, 9 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 4b312b73d8a8..b5de10102775 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -52,6 +52,23 @@ static bool __is_cp_guaranteed(struct page *page) | |||
52 | return false; | 52 | return false; |
53 | } | 53 | } |
54 | 54 | ||
55 | static enum count_type __read_io_type(struct page *page) | ||
56 | { | ||
57 | struct address_space *mapping = page->mapping; | ||
58 | |||
59 | if (mapping) { | ||
60 | struct inode *inode = mapping->host; | ||
61 | struct f2fs_sb_info *sbi = F2FS_I_SB(inode); | ||
62 | |||
63 | if (inode->i_ino == F2FS_META_INO(sbi)) | ||
64 | return F2FS_RD_META; | ||
65 | |||
66 | if (inode->i_ino == F2FS_NODE_INO(sbi)) | ||
67 | return F2FS_RD_NODE; | ||
68 | } | ||
69 | return F2FS_RD_DATA; | ||
70 | } | ||
71 | |||
55 | /* postprocessing steps for read bios */ | 72 | /* postprocessing steps for read bios */ |
56 | enum bio_post_read_step { | 73 | enum bio_post_read_step { |
57 | STEP_INITIAL = 0, | 74 | STEP_INITIAL = 0, |
@@ -82,6 +99,7 @@ static void __read_end_io(struct bio *bio) | |||
82 | } else { | 99 | } else { |
83 | SetPageUptodate(page); | 100 | SetPageUptodate(page); |
84 | } | 101 | } |
102 | dec_page_count(F2FS_P_SB(page), __read_io_type(page)); | ||
85 | unlock_page(page); | 103 | unlock_page(page); |
86 | } | 104 | } |
87 | if (bio->bi_private) | 105 | if (bio->bi_private) |
@@ -466,8 +484,8 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) | |||
466 | 484 | ||
467 | bio_set_op_attrs(bio, fio->op, fio->op_flags); | 485 | bio_set_op_attrs(bio, fio->op, fio->op_flags); |
468 | 486 | ||
469 | if (!is_read_io(fio->op)) | 487 | inc_page_count(fio->sbi, is_read_io(fio->op) ? |
470 | inc_page_count(fio->sbi, WB_DATA_TYPE(fio->page)); | 488 | __read_io_type(page): WB_DATA_TYPE(fio->page)); |
471 | 489 | ||
472 | __submit_bio(fio->sbi, bio, fio->type); | 490 | __submit_bio(fio->sbi, bio, fio->type); |
473 | return 0; | 491 | return 0; |
@@ -598,6 +616,7 @@ static int f2fs_submit_page_read(struct inode *inode, struct page *page, | |||
598 | return -EFAULT; | 616 | return -EFAULT; |
599 | } | 617 | } |
600 | ClearPageError(page); | 618 | ClearPageError(page); |
619 | inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA); | ||
601 | __submit_bio(F2FS_I_SB(inode), bio, DATA); | 620 | __submit_bio(F2FS_I_SB(inode), bio, DATA); |
602 | return 0; | 621 | return 0; |
603 | } | 622 | } |
@@ -1586,6 +1605,7 @@ submit_and_realloc: | |||
1586 | if (bio_add_page(bio, page, blocksize, 0) < blocksize) | 1605 | if (bio_add_page(bio, page, blocksize, 0) < blocksize) |
1587 | goto submit_and_realloc; | 1606 | goto submit_and_realloc; |
1588 | 1607 | ||
1608 | inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA); | ||
1589 | ClearPageError(page); | 1609 | ClearPageError(page); |
1590 | last_block_in_bio = block_nr; | 1610 | last_block_in_bio = block_nr; |
1591 | goto next_page; | 1611 | goto next_page; |
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 026e10f30889..139b4d5c83d5 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c | |||
@@ -55,6 +55,9 @@ static void update_general_status(struct f2fs_sb_info *sbi) | |||
55 | si->max_vw_cnt = atomic_read(&sbi->max_vw_cnt); | 55 | si->max_vw_cnt = atomic_read(&sbi->max_vw_cnt); |
56 | si->nr_wb_cp_data = get_pages(sbi, F2FS_WB_CP_DATA); | 56 | si->nr_wb_cp_data = get_pages(sbi, F2FS_WB_CP_DATA); |
57 | si->nr_wb_data = get_pages(sbi, F2FS_WB_DATA); | 57 | si->nr_wb_data = get_pages(sbi, F2FS_WB_DATA); |
58 | si->nr_rd_data = get_pages(sbi, F2FS_RD_DATA); | ||
59 | si->nr_rd_node = get_pages(sbi, F2FS_RD_NODE); | ||
60 | si->nr_rd_meta = get_pages(sbi, F2FS_RD_META); | ||
58 | if (SM_I(sbi) && SM_I(sbi)->fcc_info) { | 61 | if (SM_I(sbi) && SM_I(sbi)->fcc_info) { |
59 | si->nr_flushed = | 62 | si->nr_flushed = |
60 | atomic_read(&SM_I(sbi)->fcc_info->issued_flush); | 63 | atomic_read(&SM_I(sbi)->fcc_info->issued_flush); |
@@ -371,7 +374,9 @@ static int stat_show(struct seq_file *s, void *v) | |||
371 | seq_printf(s, " - Inner Struct Count: tree: %d(%d), node: %d\n", | 374 | seq_printf(s, " - Inner Struct Count: tree: %d(%d), node: %d\n", |
372 | si->ext_tree, si->zombie_tree, si->ext_node); | 375 | si->ext_tree, si->zombie_tree, si->ext_node); |
373 | seq_puts(s, "\nBalancing F2FS Async:\n"); | 376 | seq_puts(s, "\nBalancing F2FS Async:\n"); |
374 | seq_printf(s, " - IO (CP: %4d, Data: %4d, Flush: (%4d %4d %4d), " | 377 | seq_printf(s, " - IO_R (Data: %4d, Node: %4d, Meta: %4d\n", |
378 | si->nr_rd_data, si->nr_rd_node, si->nr_rd_meta); | ||
379 | seq_printf(s, " - IO_W (CP: %4d, Data: %4d, Flush: (%4d %4d %4d), " | ||
375 | "Discard: (%4d %4d)) cmd: %4d undiscard:%4u\n", | 380 | "Discard: (%4d %4d)) cmd: %4d undiscard:%4u\n", |
376 | si->nr_wb_cp_data, si->nr_wb_data, | 381 | si->nr_wb_cp_data, si->nr_wb_data, |
377 | si->nr_flushing, si->nr_flushed, | 382 | si->nr_flushing, si->nr_flushed, |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f865c5ed965d..7f9cb0bba104 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -950,6 +950,9 @@ enum count_type { | |||
950 | F2FS_DIRTY_IMETA, | 950 | F2FS_DIRTY_IMETA, |
951 | F2FS_WB_CP_DATA, | 951 | F2FS_WB_CP_DATA, |
952 | F2FS_WB_DATA, | 952 | F2FS_WB_DATA, |
953 | F2FS_RD_DATA, | ||
954 | F2FS_RD_NODE, | ||
955 | F2FS_RD_META, | ||
953 | NR_COUNT_TYPE, | 956 | NR_COUNT_TYPE, |
954 | }; | 957 | }; |
955 | 958 | ||
@@ -1392,11 +1395,6 @@ static inline unsigned int f2fs_time_to_wait(struct f2fs_sb_info *sbi, | |||
1392 | return wait_ms; | 1395 | return wait_ms; |
1393 | } | 1396 | } |
1394 | 1397 | ||
1395 | static inline bool is_idle(struct f2fs_sb_info *sbi, int type) | ||
1396 | { | ||
1397 | return f2fs_time_over(sbi, type); | ||
1398 | } | ||
1399 | |||
1400 | /* | 1398 | /* |
1401 | * Inline functions | 1399 | * Inline functions |
1402 | */ | 1400 | */ |
@@ -1787,7 +1785,9 @@ static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) | |||
1787 | atomic_inc(&sbi->nr_pages[count_type]); | 1785 | atomic_inc(&sbi->nr_pages[count_type]); |
1788 | 1786 | ||
1789 | if (count_type == F2FS_DIRTY_DATA || count_type == F2FS_INMEM_PAGES || | 1787 | if (count_type == F2FS_DIRTY_DATA || count_type == F2FS_INMEM_PAGES || |
1790 | count_type == F2FS_WB_CP_DATA || count_type == F2FS_WB_DATA) | 1788 | count_type == F2FS_WB_CP_DATA || count_type == F2FS_WB_DATA || |
1789 | count_type == F2FS_RD_DATA || count_type == F2FS_RD_NODE || | ||
1790 | count_type == F2FS_RD_META) | ||
1791 | return; | 1791 | return; |
1792 | 1792 | ||
1793 | set_sbi_flag(sbi, SBI_IS_DIRTY); | 1793 | set_sbi_flag(sbi, SBI_IS_DIRTY); |
@@ -2124,6 +2124,15 @@ static inline struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, | |||
2124 | return bio_alloc(GFP_KERNEL, npages); | 2124 | return bio_alloc(GFP_KERNEL, npages); |
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | static inline bool is_idle(struct f2fs_sb_info *sbi, int type) | ||
2128 | { | ||
2129 | if (get_pages(sbi, F2FS_RD_DATA) || get_pages(sbi, F2FS_RD_NODE) || | ||
2130 | get_pages(sbi, F2FS_RD_META) || get_pages(sbi, F2FS_WB_DATA) || | ||
2131 | get_pages(sbi, F2FS_WB_CP_DATA)) | ||
2132 | return false; | ||
2133 | return f2fs_time_over(sbi, type); | ||
2134 | } | ||
2135 | |||
2127 | static inline void f2fs_radix_tree_insert(struct radix_tree_root *root, | 2136 | static inline void f2fs_radix_tree_insert(struct radix_tree_root *root, |
2128 | unsigned long index, void *item) | 2137 | unsigned long index, void *item) |
2129 | { | 2138 | { |
@@ -3114,6 +3123,7 @@ struct f2fs_stat_info { | |||
3114 | int free_nids, avail_nids, alloc_nids; | 3123 | int free_nids, avail_nids, alloc_nids; |
3115 | int total_count, utilization; | 3124 | int total_count, utilization; |
3116 | int bg_gc, nr_wb_cp_data, nr_wb_data; | 3125 | int bg_gc, nr_wb_cp_data, nr_wb_data; |
3126 | int nr_rd_data, nr_rd_node, nr_rd_meta; | ||
3117 | unsigned int io_skip_bggc, other_skip_bggc; | 3127 | unsigned int io_skip_bggc, other_skip_bggc; |
3118 | int nr_flushing, nr_flushed, flush_list_empty; | 3128 | int nr_flushing, nr_flushed, flush_list_empty; |
3119 | int nr_discarding, nr_discarded; | 3129 | int nr_discarding, nr_discarded; |