diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-01-10 13:09:52 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-02-12 02:04:31 +0100 |
commit | 9066c6a7eb5492dda0ccd48bb78be52feff9043c (patch) | |
tree | 9f282a3a20ab09bd86db5db34e0ce0668eedfbef /fs/f2fs/debug.c | |
parent | f2fs: avoid infinite loop on cp_error (diff) | |
download | linux-9066c6a7eb5492dda0ccd48bb78be52feff9043c.tar.xz linux-9066c6a7eb5492dda0ccd48bb78be52feff9043c.zip |
f2fs: fix wrong memory footprint statistics in debugfs
Our value of memory footprint statistics showed in debugfs is not calculated
correctly. Fix it in this patch.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/debug.c')
-rw-r--r-- | fs/f2fs/debug.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 1f0fb58072e7..b45daab97f0b 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -163,13 +163,20 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem += sizeof(struct f2fs_nm_info); si->base_mem += __bitmap_size(sbi, NAT_BITMAP); +get_cache: + si->cache_mem = 0; + /* build gc */ - si->base_mem += sizeof(struct f2fs_gc_kthread); + if (sbi->gc_thread) + si->cache_mem += sizeof(struct f2fs_gc_kthread); + + /* build merge flush thread */ + if (SM_I(sbi)->cmd_control_info) + si->cache_mem += sizeof(struct flush_cmd_control); -get_cache: /* free nids */ - si->cache_mem = NM_I(sbi)->fcnt; - si->cache_mem += NM_I(sbi)->nat_cnt; + si->cache_mem += NM_I(sbi)->fcnt * sizeof(struct free_nid); + si->cache_mem += NM_I(sbi)->nat_cnt * sizeof(struct nat_entry); npages = NODE_MAPPING(sbi)->nrpages; si->cache_mem += npages << PAGE_CACHE_SHIFT; npages = META_MAPPING(sbi)->nrpages; |