diff options
author | Shuoran Liu <liushuoran@huawei.com> | 2016-01-26 20:57:30 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-02-22 19:07:23 -0500 |
commit | 8f1dbbbbdfe9bada7e2f8041e07c6373f787c043 (patch) | |
tree | 25fb006ca5bc2f960722210241c0f9e14af9c0d1 /fs/f2fs/checkpoint.c | |
parent | 6fe2bc95616650104020e821ea84c086cce1e290 (diff) |
f2fs: introduce lifetime write IO statistics
This patch introduces lifetime IO write statistics exposed to the sysfs interface.
The write IO amount is obtained from block layer, accumulated in the file system and
stored in the hot node summary of checkpoint.
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
Signed-off-by: Pengyang Hou <houpengyang@huawei.com>
[Jaegeuk Kim: add sysfs documentation]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r-- | fs/f2fs/checkpoint.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 4b6f9c08f6fa..112e19fdbe08 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -921,6 +921,9 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
921 | int cp_payload_blks = __cp_payload(sbi); | 921 | int cp_payload_blks = __cp_payload(sbi); |
922 | block_t discard_blk = NEXT_FREE_BLKADDR(sbi, curseg); | 922 | block_t discard_blk = NEXT_FREE_BLKADDR(sbi, curseg); |
923 | bool invalidate = false; | 923 | bool invalidate = false; |
924 | struct super_block *sb = sbi->sb; | ||
925 | struct curseg_info *seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE); | ||
926 | u64 kbytes_written; | ||
924 | 927 | ||
925 | /* | 928 | /* |
926 | * This avoids to conduct wrong roll-forward operations and uses | 929 | * This avoids to conduct wrong roll-forward operations and uses |
@@ -1034,6 +1037,14 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) | |||
1034 | 1037 | ||
1035 | write_data_summaries(sbi, start_blk); | 1038 | write_data_summaries(sbi, start_blk); |
1036 | start_blk += data_sum_blocks; | 1039 | start_blk += data_sum_blocks; |
1040 | |||
1041 | /* Record write statistics in the hot node summary */ | ||
1042 | kbytes_written = sbi->kbytes_written; | ||
1043 | if (sb->s_bdev->bd_part) | ||
1044 | kbytes_written += BD_PART_WRITTEN(sbi); | ||
1045 | |||
1046 | seg_i->sum_blk->info.kbytes_written = cpu_to_le64(kbytes_written); | ||
1047 | |||
1037 | if (__remain_node_summaries(cpc->reason)) { | 1048 | if (__remain_node_summaries(cpc->reason)) { |
1038 | write_node_summaries(sbi, start_blk); | 1049 | write_node_summaries(sbi, start_blk); |
1039 | start_blk += NR_CURSEG_NODE_TYPE; | 1050 | start_blk += NR_CURSEG_NODE_TYPE; |