blob: 6b5fe7ba02960bd2aae8cae0a2f3a81f49335ab6 [file] [log] [blame]
Artem Bityutskiy1e517642008-07-14 19:08:37 +03001/*
2 * This file is part of UBIFS.
3 *
4 * Copyright (C) 2006-2008 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors: Artem Bityutskiy (Битюцкий Артём)
20 * Adrian Hunter
21 */
22
23#ifndef __UBIFS_DEBUG_H__
24#define __UBIFS_DEBUG_H__
25
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -070026/* Checking helper functions */
27typedef int (*dbg_leaf_callback)(struct ubifs_info *c,
28 struct ubifs_zbranch *zbr, void *priv);
29typedef int (*dbg_znode_callback)(struct ubifs_info *c,
30 struct ubifs_znode *znode, void *priv);
31
Artem Bityutskiy1e517642008-07-14 19:08:37 +030032#ifdef CONFIG_UBIFS_FS_DEBUG
33
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030034/**
35 * ubifs_debug_info - per-FS debugging information.
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030036 * @old_zroot: old index root - used by 'dbg_check_old_index()'
37 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
38 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
39 * @failure_mode: failure mode for recovery testing
40 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls
41 * @fail_timeout: time in jiffies when delay of failure mode expires
42 * @fail_cnt: current number of calls to failure mode I/O functions
43 * @fail_cnt_max: number of calls by which to delay failure mode
44 * @chk_lpt_sz: used by LPT tree size checker
45 * @chk_lpt_sz2: used by LPT tree size checker
46 * @chk_lpt_wastage: used by LPT tree size checker
47 * @chk_lpt_lebs: used by LPT tree size checker
48 * @new_nhead_offs: used by LPT tree size checker
Artem Bityutskiy84abf972009-01-23 14:54:59 +020049 * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
50 * @new_ihead_offs: used by debugging to check @c->ihead_offs
Artem Bityutskiy552ff312008-10-23 11:49:28 +030051 *
Artem Bityutskiy84abf972009-01-23 14:54:59 +020052 * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030053 * @saved_bi: saved budgeting information
54 * @saved_free: saved amount of free space
55 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt
Artem Bityutskiy84abf972009-01-23 14:54:59 +020056 *
57 * dfs_dir_name: name of debugfs directory containing this file-system's files
58 * dfs_dir: direntry object of the file-system debugfs directory
59 * dfs_dump_lprops: "dump lprops" debugfs knob
60 * dfs_dump_budg: "dump budgeting information" debugfs knob
61 * dfs_dump_tnc: "dump TNC" debugfs knob
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030062 */
63struct ubifs_debug_info {
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030064 struct ubifs_zbranch old_zroot;
65 int old_zroot_level;
66 unsigned long long old_zroot_sqnum;
67 int failure_mode;
68 int fail_delay;
69 unsigned long fail_timeout;
70 unsigned int fail_cnt;
71 unsigned int fail_cnt_max;
72 long long chk_lpt_sz;
73 long long chk_lpt_sz2;
74 long long chk_lpt_wastage;
75 int chk_lpt_lebs;
76 int new_nhead_offs;
77 int new_ihead_lnum;
78 int new_ihead_offs;
Artem Bityutskiy552ff312008-10-23 11:49:28 +030079
Artem Bityutskiy84abf972009-01-23 14:54:59 +020080 struct ubifs_lp_stats saved_lst;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030081 struct ubifs_budg_info saved_bi;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020082 long long saved_free;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030083 int saved_idx_gc_cnt;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020084
85 char dfs_dir_name[100];
86 struct dentry *dfs_dir;
87 struct dentry *dfs_dump_lprops;
88 struct dentry *dfs_dump_budg;
89 struct dentry *dfs_dump_tnc;
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030090};
Artem Bityutskiy1e517642008-07-14 19:08:37 +030091
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +030092#define ubifs_assert(expr) do { \
Artem Bityutskiy1e517642008-07-14 19:08:37 +030093 if (unlikely(!(expr))) { \
94 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
95 __func__, __LINE__, current->pid); \
96 dbg_dump_stack(); \
97 } \
98} while (0)
99
100#define ubifs_assert_cmt_locked(c) do { \
101 if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
102 up_write(&(c)->commit_sem); \
103 printk(KERN_CRIT "commit lock is not locked!\n"); \
104 ubifs_assert(0); \
105 } \
106} while (0)
107
108#define dbg_dump_stack() do { \
109 if (!dbg_failure_mode) \
110 dump_stack(); \
111} while (0)
112
113/* Generic debugging messages */
114#define dbg_msg(fmt, ...) do { \
115 spin_lock(&dbg_lock); \
116 printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
117 __func__, ##__VA_ARGS__); \
118 spin_unlock(&dbg_lock); \
119} while (0)
120
121#define dbg_do_msg(typ, fmt, ...) do { \
122 if (ubifs_msg_flags & typ) \
123 dbg_msg(fmt, ##__VA_ARGS__); \
124} while (0)
125
126#define dbg_err(fmt, ...) do { \
127 spin_lock(&dbg_lock); \
128 ubifs_err(fmt, ##__VA_ARGS__); \
129 spin_unlock(&dbg_lock); \
130} while (0)
131
132const char *dbg_key_str0(const struct ubifs_info *c,
133 const union ubifs_key *key);
134const char *dbg_key_str1(const struct ubifs_info *c,
135 const union ubifs_key *key);
136
137/*
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300138 * DBGKEY macros require @dbg_lock to be held, which it is in the dbg message
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300139 * macros.
140 */
141#define DBGKEY(key) dbg_key_str0(c, (key))
142#define DBGKEY1(key) dbg_key_str1(c, (key))
143
144/* General messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300145#define dbg_gen(fmt, ...) dbg_do_msg(UBIFS_MSG_GEN, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300146
147/* Additional journal messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300148#define dbg_jnl(fmt, ...) dbg_do_msg(UBIFS_MSG_JNL, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300149
150/* Additional TNC messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300151#define dbg_tnc(fmt, ...) dbg_do_msg(UBIFS_MSG_TNC, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300152
153/* Additional lprops messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300154#define dbg_lp(fmt, ...) dbg_do_msg(UBIFS_MSG_LP, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300155
156/* Additional LEB find messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300157#define dbg_find(fmt, ...) dbg_do_msg(UBIFS_MSG_FIND, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300158
159/* Additional mount messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300160#define dbg_mnt(fmt, ...) dbg_do_msg(UBIFS_MSG_MNT, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300161
162/* Additional I/O messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300163#define dbg_io(fmt, ...) dbg_do_msg(UBIFS_MSG_IO, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300164
165/* Additional commit messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300166#define dbg_cmt(fmt, ...) dbg_do_msg(UBIFS_MSG_CMT, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300167
168/* Additional budgeting messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300169#define dbg_budg(fmt, ...) dbg_do_msg(UBIFS_MSG_BUDG, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300170
171/* Additional log messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300172#define dbg_log(fmt, ...) dbg_do_msg(UBIFS_MSG_LOG, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300173
174/* Additional gc messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300175#define dbg_gc(fmt, ...) dbg_do_msg(UBIFS_MSG_GC, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300176
177/* Additional scan messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300178#define dbg_scan(fmt, ...) dbg_do_msg(UBIFS_MSG_SCAN, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300179
180/* Additional recovery messages */
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300181#define dbg_rcvry(fmt, ...) dbg_do_msg(UBIFS_MSG_RCVRY, fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300182
183/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200184 * Debugging message type flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300185 *
186 * UBIFS_MSG_GEN: general messages
187 * UBIFS_MSG_JNL: journal messages
188 * UBIFS_MSG_MNT: mount messages
189 * UBIFS_MSG_CMT: commit messages
190 * UBIFS_MSG_FIND: LEB find messages
191 * UBIFS_MSG_BUDG: budgeting messages
192 * UBIFS_MSG_GC: garbage collection messages
193 * UBIFS_MSG_TNC: TNC messages
194 * UBIFS_MSG_LP: lprops messages
195 * UBIFS_MSG_IO: I/O messages
196 * UBIFS_MSG_LOG: log messages
197 * UBIFS_MSG_SCAN: scan messages
198 * UBIFS_MSG_RCVRY: recovery messages
199 */
200enum {
201 UBIFS_MSG_GEN = 0x1,
202 UBIFS_MSG_JNL = 0x2,
203 UBIFS_MSG_MNT = 0x4,
204 UBIFS_MSG_CMT = 0x8,
205 UBIFS_MSG_FIND = 0x10,
206 UBIFS_MSG_BUDG = 0x20,
207 UBIFS_MSG_GC = 0x40,
208 UBIFS_MSG_TNC = 0x80,
209 UBIFS_MSG_LP = 0x100,
210 UBIFS_MSG_IO = 0x200,
211 UBIFS_MSG_LOG = 0x400,
212 UBIFS_MSG_SCAN = 0x800,
213 UBIFS_MSG_RCVRY = 0x1000,
214};
215
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300216/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200217 * Debugging check flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300218 *
219 * UBIFS_CHK_GEN: general checks
220 * UBIFS_CHK_TNC: check TNC
221 * UBIFS_CHK_IDX_SZ: check index size
222 * UBIFS_CHK_ORPH: check orphans
223 * UBIFS_CHK_OLD_IDX: check the old index
224 * UBIFS_CHK_LPROPS: check lprops
225 * UBIFS_CHK_FS: check the file-system
226 */
227enum {
228 UBIFS_CHK_GEN = 0x1,
229 UBIFS_CHK_TNC = 0x2,
230 UBIFS_CHK_IDX_SZ = 0x4,
231 UBIFS_CHK_ORPH = 0x8,
232 UBIFS_CHK_OLD_IDX = 0x10,
233 UBIFS_CHK_LPROPS = 0x20,
234 UBIFS_CHK_FS = 0x40,
235};
236
237/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200238 * Special testing flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300239 *
240 * UBIFS_TST_FORCE_IN_THE_GAPS: force the use of in-the-gaps method
241 * UBIFS_TST_RCVRY: failure mode for recovery testing
242 */
243enum {
244 UBIFS_TST_FORCE_IN_THE_GAPS = 0x2,
245 UBIFS_TST_RCVRY = 0x4,
246};
247
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300248extern spinlock_t dbg_lock;
249
250extern unsigned int ubifs_msg_flags;
251extern unsigned int ubifs_chk_flags;
252extern unsigned int ubifs_tst_flags;
253
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300254int ubifs_debugging_init(struct ubifs_info *c);
255void ubifs_debugging_exit(struct ubifs_info *c);
256
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300257/* Dump functions */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300258const char *dbg_ntype(int type);
259const char *dbg_cstate(int cmt_state);
Artem Bityutskiy77a7ae52009-09-15 15:03:51 +0300260const char *dbg_jhead(int jhead);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300261const char *dbg_get_key_dump(const struct ubifs_info *c,
262 const union ubifs_key *key);
263void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode);
264void dbg_dump_node(const struct ubifs_info *c, const void *node);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200265void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
266 int offs);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300267void dbg_dump_budget_req(const struct ubifs_budget_req *req);
268void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300269void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300270void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
271void dbg_dump_lprops(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300272void dbg_dump_lpt_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300273void dbg_dump_leb(const struct ubifs_info *c, int lnum);
274void dbg_dump_znode(const struct ubifs_info *c,
275 const struct ubifs_znode *znode);
276void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat);
277void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
278 struct ubifs_nnode *parent, int iip);
279void dbg_dump_tnc(struct ubifs_info *c);
280void dbg_dump_index(struct ubifs_info *c);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200281void dbg_dump_lpt_lebs(const struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300282
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300283int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
284 dbg_znode_callback znode_cb, void *priv);
285
286/* Checking functions */
Artem Bityutskiy84abf972009-01-23 14:54:59 +0200287void dbg_save_space_info(struct ubifs_info *c);
288int dbg_check_space_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300289int dbg_check_lprops(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300290int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
291int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300292int dbg_check_cats(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300293int dbg_check_ltab(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300294int dbg_chk_lpt_free_spc(struct ubifs_info *c);
295int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300296int dbg_check_synced_i_size(struct inode *inode);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300297int dbg_check_dir_size(struct ubifs_info *c, const struct inode *dir);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300298int dbg_check_tnc(struct ubifs_info *c, int extra);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300299int dbg_check_idx_size(struct ubifs_info *c, long long idx_size);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300300int dbg_check_filesystem(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300301void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
302 int add_pos);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300303int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
304 int row, int col);
Artem Bityutskiye3c3efc2009-08-27 16:34:19 +0300305int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
306 loff_t size);
Artem Bityutskiy3bb66b42010-08-07 10:06:11 +0300307int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
308int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300309
310/* Force the use of in-the-gaps method for testing */
311
312#define dbg_force_in_the_gaps_enabled \
313 (ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS)
314
315int dbg_force_in_the_gaps(void);
316
317/* Failure mode for recovery testing */
318
319#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)
320
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300321#ifndef UBIFS_DBG_PRESERVE_UBI
322
323#define ubi_leb_read dbg_leb_read
324#define ubi_leb_write dbg_leb_write
325#define ubi_leb_change dbg_leb_change
326#define ubi_leb_erase dbg_leb_erase
327#define ubi_leb_unmap dbg_leb_unmap
328#define ubi_is_mapped dbg_is_mapped
329#define ubi_leb_map dbg_leb_map
330
331#endif
332
333int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
334 int len, int check);
335int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
336 int offset, int len, int dtype);
337int dbg_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
338 int len, int dtype);
339int dbg_leb_erase(struct ubi_volume_desc *desc, int lnum);
340int dbg_leb_unmap(struct ubi_volume_desc *desc, int lnum);
341int dbg_is_mapped(struct ubi_volume_desc *desc, int lnum);
342int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
343
344static inline int dbg_read(struct ubi_volume_desc *desc, int lnum, char *buf,
345 int offset, int len)
346{
347 return dbg_leb_read(desc, lnum, buf, offset, len, 0);
348}
349
350static inline int dbg_write(struct ubi_volume_desc *desc, int lnum,
351 const void *buf, int offset, int len)
352{
353 return dbg_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
354}
355
356static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
357 const void *buf, int len)
358{
359 return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
360}
361
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300362/* Debugfs-related stuff */
363int dbg_debugfs_init(void);
364void dbg_debugfs_exit(void);
365int dbg_debugfs_init_fs(struct ubifs_info *c);
366void dbg_debugfs_exit_fs(struct ubifs_info *c);
367
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300368#else /* !CONFIG_UBIFS_FS_DEBUG */
369
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300370/* Use "if (0)" to make compiler check arguments even if debugging is off */
371#define ubifs_assert(expr) do { \
372 if (0 && (expr)) \
373 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
374 __func__, __LINE__, current->pid); \
375} while (0)
376
377#define dbg_err(fmt, ...) do { \
378 if (0) \
379 ubifs_err(fmt, ##__VA_ARGS__); \
380} while (0)
381
382#define dbg_msg(fmt, ...) do { \
383 if (0) \
384 printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", \
385 current->pid, __func__, ##__VA_ARGS__); \
386} while (0)
387
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300388#define dbg_dump_stack()
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300389#define ubifs_assert_cmt_locked(c)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300390
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300391#define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
392#define dbg_jnl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
393#define dbg_tnc(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
394#define dbg_lp(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
395#define dbg_find(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
396#define dbg_mnt(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
397#define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
398#define dbg_cmt(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
399#define dbg_budg(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
400#define dbg_log(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
401#define dbg_gc(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
402#define dbg_scan(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
403#define dbg_rcvry(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300404
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300405#define DBGKEY(key) ((char *)(key))
406#define DBGKEY1(key) ((char *)(key))
407
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700408static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; }
409static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; }
410static inline const char *dbg_ntype(int type) { return ""; }
411static inline const char *dbg_cstate(int cmt_state) { return ""; }
412static inline const char *dbg_jhead(int jhead) { return ""; }
413static inline const char *
414dbg_get_key_dump(const struct ubifs_info *c,
415 const union ubifs_key *key) { return ""; }
416static inline void dbg_dump_inode(const struct ubifs_info *c,
417 const struct inode *inode) { return; }
418static inline void dbg_dump_node(const struct ubifs_info *c,
419 const void *node) { return; }
420static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
421 void *node, int lnum,
422 int offs) { return; }
423static inline void
424dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; }
425static inline void
426dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300427static inline void
428dbg_dump_budg(struct ubifs_info *c,
429 const struct ubifs_budg_info *bi) { return; }
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700430static inline void dbg_dump_lprop(const struct ubifs_info *c,
431 const struct ubifs_lprops *lp) { return; }
432static inline void dbg_dump_lprops(struct ubifs_info *c) { return; }
433static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; }
434static inline void dbg_dump_leb(const struct ubifs_info *c,
435 int lnum) { return; }
436static inline void
437dbg_dump_znode(const struct ubifs_info *c,
438 const struct ubifs_znode *znode) { return; }
439static inline void dbg_dump_heap(struct ubifs_info *c,
440 struct ubifs_lpt_heap *heap,
441 int cat) { return; }
442static inline void dbg_dump_pnode(struct ubifs_info *c,
443 struct ubifs_pnode *pnode,
444 struct ubifs_nnode *parent,
445 int iip) { return; }
446static inline void dbg_dump_tnc(struct ubifs_info *c) { return; }
447static inline void dbg_dump_index(struct ubifs_info *c) { return; }
448static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; }
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300449
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700450static inline int dbg_walk_index(struct ubifs_info *c,
451 dbg_leaf_callback leaf_cb,
452 dbg_znode_callback znode_cb,
453 void *priv) { return 0; }
454static inline void dbg_save_space_info(struct ubifs_info *c) { return; }
455static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; }
456static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; }
457static inline int
458dbg_old_index_check_init(struct ubifs_info *c,
459 struct ubifs_zbranch *zroot) { return 0; }
460static inline int
461dbg_check_old_index(struct ubifs_info *c,
462 struct ubifs_zbranch *zroot) { return 0; }
463static inline int dbg_check_cats(struct ubifs_info *c) { return 0; }
464static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; }
465static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; }
466static inline int dbg_chk_lpt_sz(struct ubifs_info *c,
467 int action, int len) { return 0; }
468static inline int dbg_check_synced_i_size(struct inode *inode) { return 0; }
469static inline int dbg_check_dir_size(struct ubifs_info *c,
470 const struct inode *dir) { return 0; }
471static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; }
472static inline int dbg_check_idx_size(struct ubifs_info *c,
473 long long idx_size) { return 0; }
474static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; }
475static inline void dbg_check_heap(struct ubifs_info *c,
476 struct ubifs_lpt_heap *heap,
477 int cat, int add_pos) { return; }
478static inline int dbg_check_lpt_nodes(struct ubifs_info *c,
479 struct ubifs_cnode *cnode, int row, int col) { return 0; }
480static inline int dbg_check_inode_size(struct ubifs_info *c,
481 const struct inode *inode,
482 loff_t size) { return 0; }
483static inline int
484dbg_check_data_nodes_order(struct ubifs_info *c,
485 struct list_head *head) { return 0; }
486static inline int
487dbg_check_nondata_nodes_order(struct ubifs_info *c,
488 struct list_head *head) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300489
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700490static inline int dbg_force_in_the_gaps(void) { return 0; }
491#define dbg_force_in_the_gaps_enabled 0
492#define dbg_failure_mode 0
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300493
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700494static inline int dbg_debugfs_init(void) { return 0; }
495static inline void dbg_debugfs_exit(void) { return; }
496static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; }
497static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300498
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300499#endif /* !CONFIG_UBIFS_FS_DEBUG */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300500#endif /* !__UBIFS_DEBUG_H__ */