f2fs: add block count by in-place-update in stat info
authorChangman Lee <cm224.lee@samsung.com>
Tue, 23 Dec 2014 17:16:54 +0000 (02:16 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 10 Jan 2015 01:02:25 +0000 (17:02 -0800)
This patch adds block count by in-place-update in stat.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/debug.c
fs/f2fs/f2fs.h
fs/f2fs/segment.c

index 91e8f699ab307153843c8a4282a551f4cdae2a6a..2b6422156ea07fcfdfb0fd835d7d5226bed08e7e 100644 (file)
@@ -79,6 +79,8 @@ static void update_general_status(struct f2fs_sb_info *sbi)
                si->segment_count[i] = sbi->segment_count[i];
                si->block_count[i] = sbi->block_count[i];
        }
+
+       si->inplace_count = atomic_read(&sbi->inplace_count);
 }
 
 /*
@@ -277,6 +279,7 @@ static int stat_show(struct seq_file *s, void *v)
                for (j = 0; j < si->util_free; j++)
                        seq_putc(s, '-');
                seq_puts(s, "]\n\n");
+               seq_printf(s, "IPU: %u blocks\n", si->inplace_count);
                seq_printf(s, "SSR: %u blocks in %u segments\n",
                           si->block_count[SSR], si->segment_count[SSR]);
                seq_printf(s, "LFS: %u blocks in %u segments\n",
@@ -331,6 +334,7 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
 
        atomic_set(&sbi->inline_inode, 0);
        atomic_set(&sbi->inline_dir, 0);
+       atomic_set(&sbi->inplace_count, 0);
 
        mutex_lock(&f2fs_stat_mutex);
        list_add_tail(&si->stat_list, &f2fs_stat_list);
index 3f07b504f6d8aa3b553f97ce4650d64ed1e9babc..3226af06e050270d8a5955839e76b898f10e59fd 100644 (file)
@@ -592,6 +592,7 @@ struct f2fs_sb_info {
        struct f2fs_stat_info *stat_info;       /* FS status information */
        unsigned int segment_count[2];          /* # of allocated segments */
        unsigned int block_count[2];            /* # of allocated blocks */
+       atomic_t inplace_count;         /* # of inplace update */
        int total_hit_ext, read_hit_ext;        /* extent cache hit ratio */
        atomic_t inline_inode;                  /* # of inline_data inodes */
        atomic_t inline_dir;                    /* # of inline_dentry inodes */
@@ -1523,6 +1524,7 @@ struct f2fs_stat_info {
 
        unsigned int segment_count[2];
        unsigned int block_count[2];
+       unsigned int inplace_count;
        unsigned base_mem, cache_mem;
 };
 
@@ -1562,7 +1564,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
                ((sbi)->segment_count[(curseg)->alloc_type]++)
 #define stat_inc_block_count(sbi, curseg)                              \
                ((sbi)->block_count[(curseg)->alloc_type]++)
-
+#define stat_inc_inplace_blocks(sbi)                                   \
+               (atomic_inc(&(sbi)->inplace_count))
 #define stat_inc_seg_count(sbi, type)                                  \
        do {                                                            \
                struct f2fs_stat_info *si = F2FS_STAT(sbi);             \
@@ -1608,6 +1611,7 @@ void f2fs_destroy_root_stats(void);
 #define stat_dec_inline_dir(inode)
 #define stat_inc_seg_type(sbi, curseg)
 #define stat_inc_block_count(sbi, curseg)
+#define stat_inc_inplace_blocks(sbi)
 #define stat_inc_seg_count(si, type)
 #define stat_inc_tot_blk_count(si, blks)
 #define stat_inc_data_blk_count(si, blks)
index b688991514fb2f600cc51eb72e75f585b7413a91..f995a850dfe77070c845959b9143e89e271ab908 100644 (file)
@@ -1230,6 +1230,7 @@ void write_data_page(struct page *page, struct dnode_of_data *dn,
 
 void rewrite_data_page(struct page *page, struct f2fs_io_info *fio)
 {
+       stat_inc_inplace_blocks(F2FS_P_SB(page));
        f2fs_submit_page_mbio(F2FS_P_SB(page), page, fio);
 }