summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/ubifs.h
diff options
context:
space:
mode:
authorSheng Yong <shengyong1@huawei.com>2015-03-20 06:39:42 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2015-03-25 05:08:41 -0400
commit235c362bd0f6afcf767bc72aa0c647e1434cc631 (patch)
tree1cbc858f95877e51ddf48ea00dec0f6f7a481469 /fs/ubifs/ubifs.h
parent8a87dc55f75f19ffdbb52066afea1b633577c79f (diff)
UBIFS: extend debug/message capabilities
In the case where we have more than one volumes on different UBI devices, it may be not that easy to tell which volume prints the messages. Add ubi number and volume id in ubifs_msg/warn/error to help debug. These two values are passed by struct ubifs_info. For those where ubifs_info is not initialized yet, ubifs_* is replaced by pr_*. For those where ubifs_info is not avaliable, ubifs_info is passed to the calling function as a const parameter. The output looks like, [ 95.444879] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 696 [ 95.484688] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test1" [ 95.484694] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes [ 95.484699] UBIFS (ubi0:1): FS size: 30220288 bytes (28 MiB, 238 LEBs), journal size 1523712 bytes (1 MiB, 12 LEBs) [ 95.484703] UBIFS (ubi0:1): reserved for root: 1427378 bytes (1393 KiB) [ 95.484709] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 40DFFC0E-70BE-4193-8905-F7D6DFE60B17, small LPT model [ 95.489875] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 699 [ 95.529713] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "test2" [ 95.529718] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes [ 95.529724] UBIFS (ubi1:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs) [ 95.529727] UBIFS (ubi1:0): reserved for root: 935592 bytes (913 KiB) [ 95.529733] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID EEB7779D-F419-4CA9-811B-831CAC7233D4, small LPT model [ 954.264767] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node type (255 but expected 6) [ 954.367030] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1 Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs/ubifs.h')
-rw-r--r--fs/ubifs/ubifs.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 2911d2d23456..de759022f3d6 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -43,15 +43,19 @@
43#define UBIFS_VERSION 1 43#define UBIFS_VERSION 1
44 44
45/* Normal UBIFS messages */ 45/* Normal UBIFS messages */
46#define ubifs_msg(fmt, ...) pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) 46#define ubifs_msg(c, fmt, ...) \
47 pr_notice("UBIFS (ubi%d:%d): " fmt "\n", \
48 (c)->vi.ubi_num, (c)->vi.vol_id, ##__VA_ARGS__)
47/* UBIFS error messages */ 49/* UBIFS error messages */
48#define ubifs_err(fmt, ...) \ 50#define ubifs_err(c, fmt, ...) \
49 pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ 51 pr_err("UBIFS error (ubi%d:%d pid %d): %s: " fmt "\n", \
52 (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \
50 __func__, ##__VA_ARGS__) 53 __func__, ##__VA_ARGS__)
51/* UBIFS warning messages */ 54/* UBIFS warning messages */
52#define ubifs_warn(fmt, ...) \ 55#define ubifs_warn(c, fmt, ...) \
53 pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ 56 pr_warn("UBIFS warning (ubi%d:%d pid %d): %s: " fmt "\n", \
54 current->pid, __func__, ##__VA_ARGS__) 57 (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \
58 __func__, ##__VA_ARGS__)
55/* 59/*
56 * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description 60 * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description
57 * object as an argument. 61 * object as an argument.
@@ -59,7 +63,7 @@
59#define ubifs_errc(c, fmt, ...) \ 63#define ubifs_errc(c, fmt, ...) \
60 do { \ 64 do { \
61 if (!(c)->probing) \ 65 if (!(c)->probing) \
62 ubifs_err(fmt, ##__VA_ARGS__); \ 66 ubifs_err(c, fmt, ##__VA_ARGS__); \
63 } while (0) 67 } while (0)
64 68
65/* UBIFS file system VFS magic number */ 69/* UBIFS file system VFS magic number */
@@ -1787,10 +1791,10 @@ long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1787/* compressor.c */ 1791/* compressor.c */
1788int __init ubifs_compressors_init(void); 1792int __init ubifs_compressors_init(void);
1789void ubifs_compressors_exit(void); 1793void ubifs_compressors_exit(void);
1790void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, 1794void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len,
1791 int *compr_type); 1795 void *out_buf, int *out_len, int *compr_type);
1792int ubifs_decompress(const void *buf, int len, void *out, int *out_len, 1796int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
1793 int compr_type); 1797 void *out, int *out_len, int compr_type);
1794 1798
1795#include "debug.h" 1799#include "debug.h"
1796#include "misc.h" 1800#include "misc.h"