From c524723ebf5794083819c25320802452fe06da18 Mon Sep 17 00:00:00 2001 From: Younger Liu Date: Tue, 3 Dec 2013 20:11:46 +0800 Subject: f2fs: remove debufs dir if debugfs_create_file() failed When debugfs_create_file() failed in f2fs_create_root_stats(), debugfs_root should be remove. Signed-off-by: Younger Liu Cc: Younger Liu Cc: Jaegeuk Kim Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index a84b0a8e6854..b51fb3c2a8e0 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -340,14 +340,32 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi) void __init f2fs_create_root_stats(void) { + struct dentry *file; + debugfs_root = debugfs_create_dir("f2fs", NULL); - if (debugfs_root) - debugfs_create_file("status", S_IRUGO, debugfs_root, - NULL, &stat_fops); + if (!debugfs_root) + goto bail; + + file = debugfs_create_file("status", S_IRUGO, debugfs_root, + NULL, &stat_fops); + if (!file) + goto free_debugfs_dir; + + return; + +free_debugfs_dir: + debugfs_remove(debugfs_root); + +bail: + debugfs_root = NULL; + return; } void f2fs_destroy_root_stats(void) { + if (!debugfs_root) + return; + debugfs_remove_recursive(debugfs_root); debugfs_root = NULL; } -- cgit v1.2.3 From 40e1ebe97d58b141332e895facf9e69b8b430ae1 Mon Sep 17 00:00:00 2001 From: Younger Liu Date: Tue, 3 Dec 2013 21:09:29 +0800 Subject: f2fs: replace the debugfs_root with f2fs_debugfs_root This minor change for the naming conventions of debugfs_root to avoid any possible conflicts to the other filesystem. Signed-off-by: Younger Liu Cc: Younger Liu Cc: Jaegeuk Kim [Jaegeuk Kim: change the patch name] Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index b51fb3c2a8e0..61adbcbe9b87 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -24,7 +24,7 @@ #include "gc.h" static LIST_HEAD(f2fs_stat_list); -static struct dentry *debugfs_root; +static struct dentry *f2fs_debugfs_root; static DEFINE_MUTEX(f2fs_stat_mutex); static void update_general_status(struct f2fs_sb_info *sbi) @@ -342,11 +342,11 @@ void __init f2fs_create_root_stats(void) { struct dentry *file; - debugfs_root = debugfs_create_dir("f2fs", NULL); - if (!debugfs_root) + f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL); + if (!f2fs_debugfs_root) goto bail; - file = debugfs_create_file("status", S_IRUGO, debugfs_root, + file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, NULL, &stat_fops); if (!file) goto free_debugfs_dir; @@ -354,18 +354,18 @@ void __init f2fs_create_root_stats(void) return; free_debugfs_dir: - debugfs_remove(debugfs_root); + debugfs_remove(f2fs_debugfs_root); bail: - debugfs_root = NULL; + f2fs_debugfs_root = NULL; return; } void f2fs_destroy_root_stats(void) { - if (!debugfs_root) + if (!f2fs_debugfs_root) return; - debugfs_remove_recursive(debugfs_root); - debugfs_root = NULL; + debugfs_remove_recursive(f2fs_debugfs_root); + f2fs_debugfs_root = NULL; } -- cgit v1.2.3 From 0dbdc2ae9bba0a358816cc4a22e41a6ef16db8a2 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 26 Nov 2013 11:08:57 +0900 Subject: f2fs: add the number of inline_data files to status info This patch adds the number of inline_data files into the status information. Note that the number is reset whenever the filesystem is newly mounted. Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 61adbcbe9b87..711a0d4d1cba 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -45,6 +45,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->valid_count = valid_user_blocks(sbi); si->valid_node_count = valid_node_count(sbi); si->valid_inode_count = valid_inode_count(sbi); + si->inline_inode = sbi->inline_inode; si->utilization = utilization(sbi); si->free_segs = free_segments(sbi); @@ -200,6 +201,8 @@ static int stat_show(struct seq_file *s, void *v) seq_printf(s, "Other: %u)\n - Data: %u\n", si->valid_node_count - si->valid_inode_count, si->valid_count - si->valid_node_count); + seq_printf(s, " - Inline_data Inode: %u\n", + si->inline_inode); seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n", si->main_area_segs, si->main_area_sections, si->main_area_zones); -- cgit v1.2.3 From 499046ab2c256c4b239cf389ff48e0c7478f3061 Mon Sep 17 00:00:00 2001 From: Changman Lee Date: Mon, 13 Jan 2014 10:34:18 +0900 Subject: f2fs: add delimiter to seperate name and value in debug phrase Support for f2fs-tools/tools/f2stat to monitor /sys/kernel/debug/f2fs/status Signed-off-by: Changman Lee Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 711a0d4d1cba..6e4ac9a25dfd 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -246,13 +246,13 @@ static int stat_show(struct seq_file *s, void *v) seq_printf(s, "\nExtent Hit Ratio: %d / %d\n", si->hit_ext, si->total_ext); seq_printf(s, "\nBalancing F2FS Async:\n"); - seq_printf(s, " - nodes %4d in %4d\n", + seq_printf(s, " - nodes: %4d in %4d\n", si->ndirty_node, si->node_pages); - seq_printf(s, " - dents %4d in dirs:%4d\n", + seq_printf(s, " - dents: %4d in dirs:%4d\n", si->ndirty_dent, si->ndirty_dirs); - seq_printf(s, " - meta %4d in %4d\n", + seq_printf(s, " - meta: %4d in %4d\n", si->ndirty_meta, si->meta_pages); - seq_printf(s, " - NATs %5d > %lu\n", + seq_printf(s, " - NATs: %5d > %lu\n", si->nats, NM_WOUT_THRESHOLD); seq_printf(s, " - SITs: %5d\n - free_nids: %5d\n", si->sits, si->fnids); -- cgit v1.2.3 From 6c311ec6c2d9e015d454b4e3fda8008b5bebf316 Mon Sep 17 00:00:00 2001 From: Chris Fries Date: Fri, 17 Jan 2014 14:44:39 -0600 Subject: f2fs: clean checkpatch warnings Fixed a variety of trivial checkpatch warnings. The only delta should be some minor formatting on log strings that were split / too long. Signed-off-by: Chris Fries Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 6e4ac9a25dfd..63cb7e215e00 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -245,7 +245,7 @@ static int stat_show(struct seq_file *s, void *v) seq_printf(s, " - node blocks : %d\n", si->node_blks); seq_printf(s, "\nExtent Hit Ratio: %d / %d\n", si->hit_ext, si->total_ext); - seq_printf(s, "\nBalancing F2FS Async:\n"); + seq_puts(s, "\nBalancing F2FS Async:\n"); seq_printf(s, " - nodes: %4d in %4d\n", si->ndirty_node, si->node_pages); seq_printf(s, " - dents: %4d in dirs:%4d\n", -- cgit v1.2.3 From 9df27d982d58b9372bc476fb6b9bab861d617029 Mon Sep 17 00:00:00 2001 From: Gu Zheng Date: Mon, 20 Jan 2014 18:37:04 +0800 Subject: f2fs: add help function META_MAPPING Introduce help function META_MAPPING() to get the cache meta blocks' address space. Signed-off-by: Gu Zheng Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 63cb7e215e00..8bdc365be9e3 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -53,7 +53,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->prefree_count = prefree_segments(sbi); si->dirty_count = dirty_segments(sbi); si->node_pages = sbi->node_inode->i_mapping->nrpages; - si->meta_pages = sbi->meta_inode->i_mapping->nrpages; + si->meta_pages = META_MAPPING(sbi)->nrpages; si->nats = NM_I(sbi)->nat_cnt; si->sits = SIT_I(sbi)->dirty_sentries; si->fnids = NM_I(sbi)->fcnt; @@ -168,7 +168,7 @@ get_cache: si->cache_mem += NM_I(sbi)->nat_cnt; npages = sbi->node_inode->i_mapping->nrpages; si->cache_mem += npages << PAGE_CACHE_SHIFT; - npages = sbi->meta_inode->i_mapping->nrpages; + npages = META_MAPPING(sbi)->nrpages; si->cache_mem += npages << PAGE_CACHE_SHIFT; si->cache_mem += sbi->n_orphans * sizeof(struct orphan_inode_entry); si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry); -- cgit v1.2.3 From 4ef51a8fcc7c54ca3ad948a8b4310b3bd5490c72 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 21 Jan 2014 18:51:16 +0900 Subject: f2fs: introduce NODE_MAPPING for code consistency This patch adds NODE_MAPPING which is similar as META_MAPPING introduced by Gu Zheng. Cc: Gu Zheng Signed-off-by: Jaegeuk Kim --- fs/f2fs/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/f2fs/debug.c') diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 8bdc365be9e3..3de9d20d0c14 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -52,7 +52,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->free_secs = free_sections(sbi); si->prefree_count = prefree_segments(sbi); si->dirty_count = dirty_segments(sbi); - si->node_pages = sbi->node_inode->i_mapping->nrpages; + si->node_pages = NODE_MAPPING(sbi)->nrpages; si->meta_pages = META_MAPPING(sbi)->nrpages; si->nats = NM_I(sbi)->nat_cnt; si->sits = SIT_I(sbi)->dirty_sentries; @@ -166,7 +166,7 @@ get_cache: /* free nids */ si->cache_mem = NM_I(sbi)->fcnt; si->cache_mem += NM_I(sbi)->nat_cnt; - npages = sbi->node_inode->i_mapping->nrpages; + npages = NODE_MAPPING(sbi)->nrpages; si->cache_mem += npages << PAGE_CACHE_SHIFT; npages = META_MAPPING(sbi)->nrpages; si->cache_mem += npages << PAGE_CACHE_SHIFT; -- cgit v1.2.3