aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/debug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 00:01:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 00:01:44 -0500
commitf9a03ae123c92c1f45cd2ca88d0f6edd787be78c (patch)
treec15c8b9b5732eb36b591bf570de63f3c30d252e1 /fs/f2fs/debug.c
parent1289ace5b4f70f1e68ce785735b82c7e483de863 (diff)
parent447135a86659c646017b8e707c1243c186bf2dff (diff)
Merge tag 'for-f2fs-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "This series adds two ioctls to control cached data and fragmented files. Most of the rest fixes missing error cases and bugs that we have not covered so far. Summary: Enhancements: - support an ioctl to execute online file defragmentation - support an ioctl to flush cached data - speed up shrinking of extent_cache entries - handle broken superblock - refector dirty inode management infra - revisit f2fs_map_blocks to handle more cases - reduce global lock coverage - add detecting user's idle time Major bug fixes: - fix data race condition on cached nat entries - fix error cases of volatile and atomic writes" * tag 'for-f2fs-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (87 commits) f2fs: should unset atomic flag after successful commit f2fs: fix wrong memory condition check f2fs: monitor the number of background checkpoint f2fs: detect idle time depending on user behavior f2fs: introduce time and interval facility f2fs: skip releasing nodes in chindless extent tree f2fs: use atomic type for node count in extent tree f2fs: recognize encrypted data in f2fs_fiemap f2fs: clean up f2fs_balance_fs f2fs: remove redundant calls f2fs: avoid unnecessary f2fs_balance_fs calls f2fs: check the page status filled from disk f2fs: introduce __get_node_page to reuse common code f2fs: check node id earily when readaheading node page f2fs: read isize while holding i_mutex in fiemap Revert "f2fs: check the node block address of newly allocated nid" f2fs: cover more area with nat_tree_lock f2fs: introduce max_file_blocks in sbi f2fs crypto: check CONFIG_F2FS_FS_XATTR for encrypted symlink f2fs: introduce zombie list for fast shrinking extent trees ...
Diffstat (limited to 'fs/f2fs/debug.c')
-rw-r--r--fs/f2fs/debug.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index ad1b18a7705b..4fb6ef88a34f 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -38,12 +38,15 @@ static void update_general_status(struct f2fs_sb_info *sbi)
38 si->hit_rbtree = atomic64_read(&sbi->read_hit_rbtree); 38 si->hit_rbtree = atomic64_read(&sbi->read_hit_rbtree);
39 si->hit_total = si->hit_largest + si->hit_cached + si->hit_rbtree; 39 si->hit_total = si->hit_largest + si->hit_cached + si->hit_rbtree;
40 si->total_ext = atomic64_read(&sbi->total_hit_ext); 40 si->total_ext = atomic64_read(&sbi->total_hit_ext);
41 si->ext_tree = sbi->total_ext_tree; 41 si->ext_tree = atomic_read(&sbi->total_ext_tree);
42 si->zombie_tree = atomic_read(&sbi->total_zombie_tree);
42 si->ext_node = atomic_read(&sbi->total_ext_node); 43 si->ext_node = atomic_read(&sbi->total_ext_node);
43 si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES); 44 si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES);
44 si->ndirty_dent = get_pages(sbi, F2FS_DIRTY_DENTS); 45 si->ndirty_dent = get_pages(sbi, F2FS_DIRTY_DENTS);
45 si->ndirty_dirs = sbi->n_dirty_dirs;
46 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META); 46 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META);
47 si->ndirty_data = get_pages(sbi, F2FS_DIRTY_DATA);
48 si->ndirty_dirs = sbi->ndirty_inode[DIR_INODE];
49 si->ndirty_files = sbi->ndirty_inode[FILE_INODE];
47 si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES); 50 si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES);
48 si->wb_pages = get_pages(sbi, F2FS_WRITEBACK); 51 si->wb_pages = get_pages(sbi, F2FS_WRITEBACK);
49 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg; 52 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg;
@@ -105,7 +108,7 @@ static void update_sit_info(struct f2fs_sb_info *sbi)
105 108
106 bimodal = 0; 109 bimodal = 0;
107 total_vblocks = 0; 110 total_vblocks = 0;
108 blks_per_sec = sbi->segs_per_sec * (1 << sbi->log_blocks_per_seg); 111 blks_per_sec = sbi->segs_per_sec * sbi->blocks_per_seg;
109 hblks_per_sec = blks_per_sec / 2; 112 hblks_per_sec = blks_per_sec / 2;
110 for (segno = 0; segno < MAIN_SEGS(sbi); segno += sbi->segs_per_sec) { 113 for (segno = 0; segno < MAIN_SEGS(sbi); segno += sbi->segs_per_sec) {
111 vblocks = get_valid_blocks(sbi, segno, sbi->segs_per_sec); 114 vblocks = get_valid_blocks(sbi, segno, sbi->segs_per_sec);
@@ -189,10 +192,10 @@ get_cache:
189 si->cache_mem += NM_I(sbi)->dirty_nat_cnt * 192 si->cache_mem += NM_I(sbi)->dirty_nat_cnt *
190 sizeof(struct nat_entry_set); 193 sizeof(struct nat_entry_set);
191 si->cache_mem += si->inmem_pages * sizeof(struct inmem_pages); 194 si->cache_mem += si->inmem_pages * sizeof(struct inmem_pages);
192 si->cache_mem += sbi->n_dirty_dirs * sizeof(struct inode_entry);
193 for (i = 0; i <= UPDATE_INO; i++) 195 for (i = 0; i <= UPDATE_INO; i++)
194 si->cache_mem += sbi->im[i].ino_num * sizeof(struct ino_entry); 196 si->cache_mem += sbi->im[i].ino_num * sizeof(struct ino_entry);
195 si->cache_mem += sbi->total_ext_tree * sizeof(struct extent_tree); 197 si->cache_mem += atomic_read(&sbi->total_ext_tree) *
198 sizeof(struct extent_tree);
196 si->cache_mem += atomic_read(&sbi->total_ext_node) * 199 si->cache_mem += atomic_read(&sbi->total_ext_node) *
197 sizeof(struct extent_node); 200 sizeof(struct extent_node);
198 201
@@ -267,7 +270,8 @@ static int stat_show(struct seq_file *s, void *v)
267 si->dirty_count); 270 si->dirty_count);
268 seq_printf(s, " - Prefree: %d\n - Free: %d (%d)\n\n", 271 seq_printf(s, " - Prefree: %d\n - Free: %d (%d)\n\n",
269 si->prefree_count, si->free_segs, si->free_secs); 272 si->prefree_count, si->free_segs, si->free_secs);
270 seq_printf(s, "CP calls: %d\n", si->cp_count); 273 seq_printf(s, "CP calls: %d (BG: %d)\n",
274 si->cp_count, si->bg_cp_count);
271 seq_printf(s, "GC calls: %d (BG: %d)\n", 275 seq_printf(s, "GC calls: %d (BG: %d)\n",
272 si->call_count, si->bg_gc); 276 si->call_count, si->bg_gc);
273 seq_printf(s, " - data segments : %d (%d)\n", 277 seq_printf(s, " - data segments : %d (%d)\n",
@@ -288,8 +292,8 @@ static int stat_show(struct seq_file *s, void *v)
288 !si->total_ext ? 0 : 292 !si->total_ext ? 0 :
289 div64_u64(si->hit_total * 100, si->total_ext), 293 div64_u64(si->hit_total * 100, si->total_ext),
290 si->hit_total, si->total_ext); 294 si->hit_total, si->total_ext);
291 seq_printf(s, " - Inner Struct Count: tree: %d, node: %d\n", 295 seq_printf(s, " - Inner Struct Count: tree: %d(%d), node: %d\n",
292 si->ext_tree, si->ext_node); 296 si->ext_tree, si->zombie_tree, si->ext_node);
293 seq_puts(s, "\nBalancing F2FS Async:\n"); 297 seq_puts(s, "\nBalancing F2FS Async:\n");
294 seq_printf(s, " - inmem: %4d, wb: %4d\n", 298 seq_printf(s, " - inmem: %4d, wb: %4d\n",
295 si->inmem_pages, si->wb_pages); 299 si->inmem_pages, si->wb_pages);
@@ -297,6 +301,8 @@ static int stat_show(struct seq_file *s, void *v)
297 si->ndirty_node, si->node_pages); 301 si->ndirty_node, si->node_pages);
298 seq_printf(s, " - dents: %4d in dirs:%4d\n", 302 seq_printf(s, " - dents: %4d in dirs:%4d\n",
299 si->ndirty_dent, si->ndirty_dirs); 303 si->ndirty_dent, si->ndirty_dirs);
304 seq_printf(s, " - datas: %4d in files:%4d\n",
305 si->ndirty_data, si->ndirty_files);
300 seq_printf(s, " - meta: %4d in %4d\n", 306 seq_printf(s, " - meta: %4d in %4d\n",
301 si->ndirty_meta, si->meta_pages); 307 si->ndirty_meta, si->meta_pages);
302 seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n", 308 seq_printf(s, " - NATs: %9d/%9d\n - SITs: %9d/%9d\n",
@@ -404,20 +410,23 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
404 kfree(si); 410 kfree(si);
405} 411}
406 412
407void __init f2fs_create_root_stats(void) 413int __init f2fs_create_root_stats(void)
408{ 414{
409 struct dentry *file; 415 struct dentry *file;
410 416
411 f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL); 417 f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL);
412 if (!f2fs_debugfs_root) 418 if (!f2fs_debugfs_root)
413 return; 419 return -ENOMEM;
414 420
415 file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, 421 file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root,
416 NULL, &stat_fops); 422 NULL, &stat_fops);
417 if (!file) { 423 if (!file) {
418 debugfs_remove(f2fs_debugfs_root); 424 debugfs_remove(f2fs_debugfs_root);
419 f2fs_debugfs_root = NULL; 425 f2fs_debugfs_root = NULL;
426 return -ENOMEM;
420 } 427 }
428
429 return 0;
421} 430}
422 431
423void f2fs_destroy_root_stats(void) 432void f2fs_destroy_root_stats(void)