summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorChangman Lee <cm224.lee@samsung.com>2014-12-22 18:37:39 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2015-04-10 18:08:32 -0400
commite1235983e385afafb33bab3578bfc83a7d871ce1 (patch)
tree758eb74b210bc64017b81a9bb3bfbe59e2f8114a /fs/f2fs/f2fs.h
parentb28c3f94933dae663eeca24637bf9ff962bf02dc (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/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h23
1 files changed, 15 insertions, 8 deletions
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
1713int f2fs_build_stats(struct f2fs_sb_info *); 1720int 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
1737static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 1744static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
1738static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 1745static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }