aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/debug.c')
-rw-r--r--fs/f2fs/debug.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 91e8f699ab30..e671373cc8ab 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -40,6 +40,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
40 si->ndirty_dirs = sbi->n_dirty_dirs; 40 si->ndirty_dirs = sbi->n_dirty_dirs;
41 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META); 41 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META);
42 si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES); 42 si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES);
43 si->wb_pages = get_pages(sbi, F2FS_WRITEBACK);
43 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg; 44 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg;
44 si->rsvd_segs = reserved_segments(sbi); 45 si->rsvd_segs = reserved_segments(sbi);
45 si->overp_segs = overprovision_segments(sbi); 46 si->overp_segs = overprovision_segments(sbi);
@@ -57,7 +58,9 @@ static void update_general_status(struct f2fs_sb_info *sbi)
57 si->node_pages = NODE_MAPPING(sbi)->nrpages; 58 si->node_pages = NODE_MAPPING(sbi)->nrpages;
58 si->meta_pages = META_MAPPING(sbi)->nrpages; 59 si->meta_pages = META_MAPPING(sbi)->nrpages;
59 si->nats = NM_I(sbi)->nat_cnt; 60 si->nats = NM_I(sbi)->nat_cnt;
60 si->sits = SIT_I(sbi)->dirty_sentries; 61 si->dirty_nats = NM_I(sbi)->dirty_nat_cnt;
62 si->sits = MAIN_SEGS(sbi);
63 si->dirty_sits = SIT_I(sbi)->dirty_sentries;
61 si->fnids = NM_I(sbi)->fcnt; 64 si->fnids = NM_I(sbi)->fcnt;
62 si->bg_gc = sbi->bg_gc; 65 si->bg_gc = sbi->bg_gc;
63 si->util_free = (int)(free_user_blocks(sbi) >> sbi->log_blocks_per_seg) 66 si->util_free = (int)(free_user_blocks(sbi) >> sbi->log_blocks_per_seg)
@@ -79,6 +82,8 @@ static void update_general_status(struct f2fs_sb_info *sbi)
79 si->segment_count[i] = sbi->segment_count[i]; 82 si->segment_count[i] = sbi->segment_count[i];
80 si->block_count[i] = sbi->block_count[i]; 83 si->block_count[i] = sbi->block_count[i];
81 } 84 }
85
86 si->inplace_count = atomic_read(&sbi->inplace_count);
82} 87}
83 88
84/* 89/*
@@ -137,6 +142,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
137 si->base_mem += MAIN_SEGS(sbi) * sizeof(struct seg_entry); 142 si->base_mem += MAIN_SEGS(sbi) * sizeof(struct seg_entry);
138 si->base_mem += f2fs_bitmap_size(MAIN_SEGS(sbi)); 143 si->base_mem += f2fs_bitmap_size(MAIN_SEGS(sbi));
139 si->base_mem += 2 * SIT_VBLOCK_MAP_SIZE * MAIN_SEGS(sbi); 144 si->base_mem += 2 * SIT_VBLOCK_MAP_SIZE * MAIN_SEGS(sbi);
145 si->base_mem += SIT_VBLOCK_MAP_SIZE;
140 if (sbi->segs_per_sec > 1) 146 if (sbi->segs_per_sec > 1)
141 si->base_mem += MAIN_SECS(sbi) * sizeof(struct sec_entry); 147 si->base_mem += MAIN_SECS(sbi) * sizeof(struct sec_entry);
142 si->base_mem += __bitmap_size(sbi, SIT_BITMAP); 148 si->base_mem += __bitmap_size(sbi, SIT_BITMAP);
@@ -159,20 +165,32 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
159 si->base_mem += sizeof(struct f2fs_nm_info); 165 si->base_mem += sizeof(struct f2fs_nm_info);
160 si->base_mem += __bitmap_size(sbi, NAT_BITMAP); 166 si->base_mem += __bitmap_size(sbi, NAT_BITMAP);
161 167
168get_cache:
169 si->cache_mem = 0;
170
162 /* build gc */ 171 /* build gc */
163 si->base_mem += sizeof(struct f2fs_gc_kthread); 172 if (sbi->gc_thread)
173 si->cache_mem += sizeof(struct f2fs_gc_kthread);
174
175 /* build merge flush thread */
176 if (SM_I(sbi)->cmd_control_info)
177 si->cache_mem += sizeof(struct flush_cmd_control);
164 178
165get_cache:
166 /* free nids */ 179 /* free nids */
167 si->cache_mem = NM_I(sbi)->fcnt; 180 si->cache_mem += NM_I(sbi)->fcnt * sizeof(struct free_nid);
168 si->cache_mem += NM_I(sbi)->nat_cnt; 181 si->cache_mem += NM_I(sbi)->nat_cnt * sizeof(struct nat_entry);
169 npages = NODE_MAPPING(sbi)->nrpages; 182 si->cache_mem += NM_I(sbi)->dirty_nat_cnt *
170 si->cache_mem += npages << PAGE_CACHE_SHIFT; 183 sizeof(struct nat_entry_set);
171 npages = META_MAPPING(sbi)->nrpages; 184 si->cache_mem += si->inmem_pages * sizeof(struct inmem_pages);
172 si->cache_mem += npages << PAGE_CACHE_SHIFT; 185 si->cache_mem += sbi->n_dirty_dirs * sizeof(struct inode_entry);
173 si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry);
174 for (i = 0; i <= UPDATE_INO; i++) 186 for (i = 0; i <= UPDATE_INO; i++)
175 si->cache_mem += sbi->im[i].ino_num * sizeof(struct ino_entry); 187 si->cache_mem += sbi->im[i].ino_num * sizeof(struct ino_entry);
188
189 si->page_mem = 0;
190 npages = NODE_MAPPING(sbi)->nrpages;
191 si->page_mem += npages << PAGE_CACHE_SHIFT;
192 npages = META_MAPPING(sbi)->nrpages;
193 si->page_mem += npages << PAGE_CACHE_SHIFT;
176} 194}
177 195
178static int stat_show(struct seq_file *s, void *v) 196static int stat_show(struct seq_file *s, void *v)
@@ -250,16 +268,16 @@ static int stat_show(struct seq_file *s, void *v)
250 seq_printf(s, "\nExtent Hit Ratio: %d / %d\n", 268 seq_printf(s, "\nExtent Hit Ratio: %d / %d\n",
251 si->hit_ext, si->total_ext); 269 si->hit_ext, si->total_ext);
252 seq_puts(s, "\nBalancing F2FS Async:\n"); 270 seq_puts(s, "\nBalancing F2FS Async:\n");
253 seq_printf(s, " - inmem: %4d\n", 271 seq_printf(s, " - inmem: %4d, wb: %4d\n",
254 si->inmem_pages); 272 si->inmem_pages, si->wb_pages);
255 seq_printf(s, " - nodes: %4d in %4d\n", 273 seq_printf(s, " - nodes: %4d in %4d\n",
256 si->ndirty_node, si->node_pages); 274 si->ndirty_node, si->node_pages);
257 seq_printf(s, " - dents: %4d in dirs:%4d\n", 275 seq_printf(s, " - dents: %4d in dirs:%4d\n",
258 si->ndirty_dent, si->ndirty_dirs); 276 si->ndirty_dent, si->ndirty_dirs);
259 seq_printf(s, " - meta: %4d in %4d\n", 277 seq_printf(s, " - meta: %4d in %4d\n",
260 si->ndirty_meta, si->meta_pages); 278 si->ndirty_meta, si->meta_pages);
261 seq_printf(s, " - NATs: %9d\n - SITs: %9d\n", 279 seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n",
262 si->nats, si->sits); 280 si->dirty_nats, si->nats, si->dirty_sits, si->sits);
263 seq_printf(s, " - free_nids: %9d\n", 281 seq_printf(s, " - free_nids: %9d\n",
264 si->fnids); 282 si->fnids);
265 seq_puts(s, "\nDistribution of User Blocks:"); 283 seq_puts(s, "\nDistribution of User Blocks:");
@@ -277,6 +295,7 @@ static int stat_show(struct seq_file *s, void *v)
277 for (j = 0; j < si->util_free; j++) 295 for (j = 0; j < si->util_free; j++)
278 seq_putc(s, '-'); 296 seq_putc(s, '-');
279 seq_puts(s, "]\n\n"); 297 seq_puts(s, "]\n\n");
298 seq_printf(s, "IPU: %u blocks\n", si->inplace_count);
280 seq_printf(s, "SSR: %u blocks in %u segments\n", 299 seq_printf(s, "SSR: %u blocks in %u segments\n",
281 si->block_count[SSR], si->segment_count[SSR]); 300 si->block_count[SSR], si->segment_count[SSR]);
282 seq_printf(s, "LFS: %u blocks in %u segments\n", 301 seq_printf(s, "LFS: %u blocks in %u segments\n",
@@ -289,9 +308,14 @@ static int stat_show(struct seq_file *s, void *v)
289 308
290 /* memory footprint */ 309 /* memory footprint */
291 update_mem_info(si->sbi); 310 update_mem_info(si->sbi);
292 seq_printf(s, "\nMemory: %u KB = static: %u + cached: %u\n", 311 seq_printf(s, "\nMemory: %u KB\n",
293 (si->base_mem + si->cache_mem) >> 10, 312 (si->base_mem + si->cache_mem + si->page_mem) >> 10);
294 si->base_mem >> 10, si->cache_mem >> 10); 313 seq_printf(s, " - static: %u KB\n",
314 si->base_mem >> 10);
315 seq_printf(s, " - cached: %u KB\n",
316 si->cache_mem >> 10);
317 seq_printf(s, " - paged : %u KB\n",
318 si->page_mem >> 10);
295 } 319 }
296 mutex_unlock(&f2fs_stat_mutex); 320 mutex_unlock(&f2fs_stat_mutex);
297 return 0; 321 return 0;
@@ -331,6 +355,7 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
331 355
332 atomic_set(&sbi->inline_inode, 0); 356 atomic_set(&sbi->inline_inode, 0);
333 atomic_set(&sbi->inline_dir, 0); 357 atomic_set(&sbi->inline_dir, 0);
358 atomic_set(&sbi->inplace_count, 0);
334 359
335 mutex_lock(&f2fs_stat_mutex); 360 mutex_lock(&f2fs_stat_mutex);
336 list_add_tail(&si->stat_list, &f2fs_stat_list); 361 list_add_tail(&si->stat_list, &f2fs_stat_list);