diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-19 13:13:16 +0200 |
---|---|---|
committer | Artem Bityutskiy <dedekind1@gmail.com> | 2011-07-04 09:54:26 +0200 |
commit | ae380ce04731579f45f27b3a84d7d8d8ee1f9b1b (patch) | |
tree | f887f69b40899eb6bc5a61554da9485100ed2f89 /fs/ubifs/debug.h | |
parent | UBIFS: return EROFS in case of broken commit (diff) | |
download | linux-ae380ce04731579f45f27b3a84d7d8d8ee1f9b1b.tar.xz linux-ae380ce04731579f45f27b3a84d7d8d8ee1f9b1b.zip |
UBIFS: lessen the size of debugging info data structure
This patch lessens the 'struct ubifs_debug_info' size by 90 bytes by
allocating less bytes for the debugfs root directory name. It introduces macros
for the name patter an length instead of hard-coding 100 bytes. It also makes
UBIFS use 'snprintf()' and teaches it to gracefully catch situations when the
name array is too short.
Additionally, this patch makes 2 unrelated changes - I just thought they do not
deserve separate commits: simplifies 'ubifs_assert()' for non-debugging case
and makes 'dbg_debugfs_init()' properly verify debugfs return code which may be
an error code or NULL, so we should you 'IS_ERR_OR_NULL()' instead of
'IS_ERR()'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r-- | fs/ubifs/debug.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index a811ac4a26bb..b59c43a4149c 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -33,6 +33,13 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c, #include <linux/random.h> +/* + * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" + * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. + */ +#define UBIFS_DFS_DIR_NAME "ubi%d_%d" +#define UBIFS_DFS_DIR_LEN (3 + 1 + 2*2 + 1) + /** * ubifs_debug_info - per-FS debugging information. * @old_zroot: old index root - used by 'dbg_check_old_index()' @@ -84,7 +91,7 @@ struct ubifs_debug_info { long long saved_free; int saved_idx_gc_cnt; - char dfs_dir_name[100]; + char dfs_dir_name[UBIFS_DFS_DIR_LEN + 1]; struct dentry *dfs_dir; struct dentry *dfs_dump_lprops; struct dentry *dfs_dump_budg; @@ -313,7 +320,7 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); /* Use "if (0)" to make compiler check arguments even if debugging is off */ #define ubifs_assert(expr) do { \ - if (0 && (expr)) \ + if (0) \ printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ __func__, __LINE__, current->pid); \ } while (0) |