diff options
| author | Changman Lee <cm224.lee@samsung.com> | 2014-12-22 18:37:39 -0500 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-10 18:08:32 -0400 |
| commit | e1235983e385afafb33bab3578bfc83a7d871ce1 (patch) | |
| tree | 758eb74b210bc64017b81a9bb3bfbe59e2f8114a /fs/f2fs | |
| parent | b28c3f94933dae663eeca24637bf9ff962bf02dc (diff) | |
f2fs: add stat info for moved blocks by background gc
This patch is for looking into gc performance of f2fs in detail.
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
[Jaegeuk Kim: fix build errors]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
| -rw-r--r-- | fs/f2fs/debug.c | 15 | ||||
| -rw-r--r-- | fs/f2fs/f2fs.h | 23 | ||||
| -rw-r--r-- | fs/f2fs/gc.c | 6 |
3 files changed, 28 insertions, 16 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 1006290ed6b8..f5388f37217e 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c | |||
| @@ -265,11 +265,16 @@ static int stat_show(struct seq_file *s, void *v) | |||
| 265 | seq_printf(s, "CP calls: %d\n", si->cp_count); | 265 | seq_printf(s, "CP calls: %d\n", si->cp_count); |
| 266 | seq_printf(s, "GC calls: %d (BG: %d)\n", | 266 | seq_printf(s, "GC calls: %d (BG: %d)\n", |
| 267 | si->call_count, si->bg_gc); | 267 | si->call_count, si->bg_gc); |
| 268 | seq_printf(s, " - data segments : %d\n", si->data_segs); | 268 | seq_printf(s, " - data segments : %d (%d)\n", |
| 269 | seq_printf(s, " - node segments : %d\n", si->node_segs); | 269 | si->data_segs, si->bg_data_segs); |
| 270 | seq_printf(s, "Try to move %d blocks\n", si->tot_blks); | 270 | seq_printf(s, " - node segments : %d (%d)\n", |
| 271 | seq_printf(s, " - data blocks : %d\n", si->data_blks); | 271 | si->node_segs, si->bg_node_segs); |
| 272 | seq_printf(s, " - node blocks : %d\n", si->node_blks); | 272 | seq_printf(s, "Try to move %d blocks (BG: %d)\n", si->tot_blks, |
| 273 | si->bg_data_blks + si->bg_node_blks); | ||
| 274 | seq_printf(s, " - data blocks : %d (%d)\n", si->data_blks, | ||
| 275 | si->bg_data_blks); | ||
| 276 | seq_printf(s, " - node blocks : %d (%d)\n", si->node_blks, | ||
| 277 | si->bg_node_blks); | ||
| 273 | seq_printf(s, "\nExtent Hit Ratio: %d / %d\n", | 278 | seq_printf(s, "\nExtent Hit Ratio: %d / %d\n", |
| 274 | si->hit_ext, si->total_ext); | 279 | si->hit_ext, si->total_ext); |
| 275 | seq_printf(s, "\nExtent Tree Count: %d\n", si->ext_tree); | 280 | seq_printf(s, "\nExtent Tree Count: %d\n", si->ext_tree); |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7ced71b69f33..ca7da0464379 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
| @@ -1634,7 +1634,9 @@ struct f2fs_stat_info { | |||
| 1634 | int dirty_count, node_pages, meta_pages; | 1634 | int dirty_count, node_pages, meta_pages; |
| 1635 | int prefree_count, call_count, cp_count; | 1635 | int prefree_count, call_count, cp_count; |
| 1636 | int tot_segs, node_segs, data_segs, free_segs, free_secs; | 1636 | int tot_segs, node_segs, data_segs, free_segs, free_secs; |
| 1637 | int bg_node_segs, bg_data_segs; | ||
| 1637 | int tot_blks, data_blks, node_blks; | 1638 | int tot_blks, data_blks, node_blks; |
| 1639 | int bg_data_blks, bg_node_blks; | ||
| 1638 | int curseg[NR_CURSEG_TYPE]; | 1640 | int curseg[NR_CURSEG_TYPE]; |
| 1639 | int cursec[NR_CURSEG_TYPE]; | 1641 | int cursec[NR_CURSEG_TYPE]; |
| 1640 | int curzone[NR_CURSEG_TYPE]; | 1642 | int curzone[NR_CURSEG_TYPE]; |
| @@ -1683,31 +1685,36 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) | |||
| 1683 | ((sbi)->block_count[(curseg)->alloc_type]++) | 1685 | ((sbi)->block_count[(curseg)->alloc_type]++) |
| 1684 | #define stat_inc_inplace_blocks(sbi) \ | 1686 | #define stat_inc_inplace_blocks(sbi) \ |
| 1685 | (atomic_inc(&(sbi)->inplace_count)) | 1687 | (atomic_inc(&(sbi)->inplace_count)) |
| 1686 | #define stat_inc_seg_count(sbi, type) \ | 1688 | #define stat_inc_seg_count(sbi, type, gc_type) \ |
| 1687 | do { \ | 1689 | do { \ |
| 1688 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1690 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
| 1689 | (si)->tot_segs++; \ | 1691 | (si)->tot_segs++; \ |
| 1690 | if (type == SUM_TYPE_DATA) \ | 1692 | if (type == SUM_TYPE_DATA) { \ |
| 1691 | si->data_segs++; \ | 1693 | si->data_segs++; \ |
| 1692 | else \ | 1694 | si->bg_data_segs += (gc_type == BG_GC) ? 1 : 0; \ |
| 1695 | } else { \ | ||
| 1693 | si->node_segs++; \ | 1696 | si->node_segs++; \ |
| 1697 | si->bg_node_segs += (gc_type == BG_GC) ? 1 : 0; \ | ||
| 1698 | } \ | ||
| 1694 | } while (0) | 1699 | } while (0) |
| 1695 | 1700 | ||
| 1696 | #define stat_inc_tot_blk_count(si, blks) \ | 1701 | #define stat_inc_tot_blk_count(si, blks) \ |
| 1697 | (si->tot_blks += (blks)) | 1702 | (si->tot_blks += (blks)) |
| 1698 | 1703 | ||
| 1699 | #define stat_inc_data_blk_count(sbi, blks) \ | 1704 | #define stat_inc_data_blk_count(sbi, blks, gc_type) \ |
| 1700 | do { \ | 1705 | do { \ |
| 1701 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1706 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
| 1702 | stat_inc_tot_blk_count(si, blks); \ | 1707 | stat_inc_tot_blk_count(si, blks); \ |
| 1703 | si->data_blks += (blks); \ | 1708 | si->data_blks += (blks); \ |
| 1709 | si->bg_data_blks += (gc_type == BG_GC) ? (blks) : 0; \ | ||
| 1704 | } while (0) | 1710 | } while (0) |
| 1705 | 1711 | ||
| 1706 | #define stat_inc_node_blk_count(sbi, blks) \ | 1712 | #define stat_inc_node_blk_count(sbi, blks, gc_type) \ |
| 1707 | do { \ | 1713 | do { \ |
| 1708 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ | 1714 | struct f2fs_stat_info *si = F2FS_STAT(sbi); \ |
| 1709 | stat_inc_tot_blk_count(si, blks); \ | 1715 | stat_inc_tot_blk_count(si, blks); \ |
| 1710 | si->node_blks += (blks); \ | 1716 | si->node_blks += (blks); \ |
| 1717 | si->bg_node_blks += (gc_type == BG_GC) ? (blks) : 0; \ | ||
| 1711 | } while (0) | 1718 | } while (0) |
| 1712 | 1719 | ||
| 1713 | int f2fs_build_stats(struct f2fs_sb_info *); | 1720 | int f2fs_build_stats(struct f2fs_sb_info *); |
| @@ -1729,10 +1736,10 @@ void f2fs_destroy_root_stats(void); | |||
| 1729 | #define stat_inc_seg_type(sbi, curseg) | 1736 | #define stat_inc_seg_type(sbi, curseg) |
| 1730 | #define stat_inc_block_count(sbi, curseg) | 1737 | #define stat_inc_block_count(sbi, curseg) |
| 1731 | #define stat_inc_inplace_blocks(sbi) | 1738 | #define stat_inc_inplace_blocks(sbi) |
| 1732 | #define stat_inc_seg_count(si, type) | 1739 | #define stat_inc_seg_count(sbi, type, gc_type) |
| 1733 | #define stat_inc_tot_blk_count(si, blks) | 1740 | #define stat_inc_tot_blk_count(si, blks) |
| 1734 | #define stat_inc_data_blk_count(si, blks) | 1741 | #define stat_inc_data_blk_count(sbi, blks, gc_type) |
| 1735 | #define stat_inc_node_blk_count(sbi, blks) | 1742 | #define stat_inc_node_blk_count(sbi, blks, gc_type) |
| 1736 | 1743 | ||
| 1737 | static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } | 1744 | static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } |
| 1738 | static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } | 1745 | static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } |
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 76adbc3641f1..ed58211fe79b 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
| @@ -435,7 +435,7 @@ next_step: | |||
| 435 | set_page_dirty(node_page); | 435 | set_page_dirty(node_page); |
| 436 | } | 436 | } |
| 437 | f2fs_put_page(node_page, 1); | 437 | f2fs_put_page(node_page, 1); |
| 438 | stat_inc_node_blk_count(sbi, 1); | 438 | stat_inc_node_blk_count(sbi, 1, gc_type); |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | if (initial) { | 441 | if (initial) { |
| @@ -622,7 +622,7 @@ next_step: | |||
| 622 | if (IS_ERR(data_page)) | 622 | if (IS_ERR(data_page)) |
| 623 | continue; | 623 | continue; |
| 624 | move_data_page(inode, data_page, gc_type); | 624 | move_data_page(inode, data_page, gc_type); |
| 625 | stat_inc_data_blk_count(sbi, 1); | 625 | stat_inc_data_blk_count(sbi, 1, gc_type); |
| 626 | } | 626 | } |
| 627 | } | 627 | } |
| 628 | 628 | ||
| @@ -680,7 +680,7 @@ static void do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno, | |||
| 680 | } | 680 | } |
| 681 | blk_finish_plug(&plug); | 681 | blk_finish_plug(&plug); |
| 682 | 682 | ||
| 683 | stat_inc_seg_count(sbi, GET_SUM_TYPE((&sum->footer))); | 683 | stat_inc_seg_count(sbi, GET_SUM_TYPE((&sum->footer)), gc_type); |
| 684 | stat_inc_call_count(sbi->stat_info); | 684 | stat_inc_call_count(sbi->stat_info); |
| 685 | 685 | ||
| 686 | f2fs_put_page(sum_page, 1); | 686 | f2fs_put_page(sum_page, 1); |
