~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to fs/ubifs/debug.h

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#ifdef CONFIG_UBIFS_FS_DEBUG
33
33
 
 
34
#include <linux/random.h>
 
35
 
34
36
/**
35
37
 * ubifs_debug_info - per-FS debugging information.
36
38
 * @old_zroot: old index root - used by 'dbg_check_old_index()'
50
52
 * @new_ihead_offs: used by debugging to check @c->ihead_offs
51
53
 *
52
54
 * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
53
 
 * @saved_free: saved free space (used by 'dbg_save_space_info()')
 
55
 * @saved_bi: saved budgeting information
 
56
 * @saved_free: saved amount of free space
 
57
 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt
54
58
 *
55
 
 * dfs_dir_name: name of debugfs directory containing this file-system's files
56
 
 * dfs_dir: direntry object of the file-system debugfs directory
57
 
 * dfs_dump_lprops: "dump lprops" debugfs knob
58
 
 * dfs_dump_budg: "dump budgeting information" debugfs knob
59
 
 * dfs_dump_tnc: "dump TNC" debugfs knob
 
59
 * @dfs_dir_name: name of debugfs directory containing this file-system's files
 
60
 * @dfs_dir: direntry object of the file-system debugfs directory
 
61
 * @dfs_dump_lprops: "dump lprops" debugfs knob
 
62
 * @dfs_dump_budg: "dump budgeting information" debugfs knob
 
63
 * @dfs_dump_tnc: "dump TNC" debugfs knob
60
64
 */
61
65
struct ubifs_debug_info {
62
66
        struct ubifs_zbranch old_zroot;
76
80
        int new_ihead_offs;
77
81
 
78
82
        struct ubifs_lp_stats saved_lst;
 
83
        struct ubifs_budg_info saved_bi;
79
84
        long long saved_free;
 
85
        int saved_idx_gc_cnt;
80
86
 
81
87
        char dfs_dir_name[100];
82
88
        struct dentry *dfs_dir;
101
107
        }                                                                      \
102
108
} while (0)
103
109
 
104
 
#define dbg_dump_stack() do {                                                  \
105
 
        if (!dbg_failure_mode)                                                 \
106
 
                dump_stack();                                                  \
107
 
} while (0)
108
 
 
109
 
/* Generic debugging messages */
110
 
#define dbg_msg(fmt, ...) do {                                                 \
111
 
        spin_lock(&dbg_lock);                                                  \
112
 
        printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid,   \
113
 
               __func__, ##__VA_ARGS__);                                       \
114
 
        spin_unlock(&dbg_lock);                                                \
115
 
} while (0)
116
 
 
117
 
#define dbg_do_msg(typ, fmt, ...) do {                                         \
118
 
        if (ubifs_msg_flags & typ)                                             \
119
 
                dbg_msg(fmt, ##__VA_ARGS__);                                   \
120
 
} while (0)
 
110
#define dbg_dump_stack() dump_stack()
121
111
 
122
112
#define dbg_err(fmt, ...) do {                                                 \
123
113
        spin_lock(&dbg_lock);                                                  \
137
127
#define DBGKEY(key) dbg_key_str0(c, (key))
138
128
#define DBGKEY1(key) dbg_key_str1(c, (key))
139
129
 
 
130
#define ubifs_dbg_msg(type, fmt, ...) do {                        \
 
131
        spin_lock(&dbg_lock);                                     \
 
132
        pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \
 
133
        spin_unlock(&dbg_lock);                                   \
 
134
} while (0)
 
135
 
 
136
/* Just a debugging messages not related to any specific UBIFS subsystem */
 
137
#define dbg_msg(fmt, ...)   ubifs_dbg_msg("msg", fmt, ##__VA_ARGS__)
140
138
/* General messages */
141
 
#define dbg_gen(fmt, ...)   dbg_do_msg(UBIFS_MSG_GEN, fmt, ##__VA_ARGS__)
142
 
 
 
139
#define dbg_gen(fmt, ...)   ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
143
140
/* Additional journal messages */
144
 
#define dbg_jnl(fmt, ...)   dbg_do_msg(UBIFS_MSG_JNL, fmt, ##__VA_ARGS__)
145
 
 
 
141
#define dbg_jnl(fmt, ...)   ubifs_dbg_msg("jnl", fmt, ##__VA_ARGS__)
146
142
/* Additional TNC messages */
147
 
#define dbg_tnc(fmt, ...)   dbg_do_msg(UBIFS_MSG_TNC, fmt, ##__VA_ARGS__)
148
 
 
 
143
#define dbg_tnc(fmt, ...)   ubifs_dbg_msg("tnc", fmt, ##__VA_ARGS__)
149
144
/* Additional lprops messages */
150
 
#define dbg_lp(fmt, ...)    dbg_do_msg(UBIFS_MSG_LP, fmt, ##__VA_ARGS__)
151
 
 
 
145
#define dbg_lp(fmt, ...)    ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
152
146
/* Additional LEB find messages */
153
 
#define dbg_find(fmt, ...)  dbg_do_msg(UBIFS_MSG_FIND, fmt, ##__VA_ARGS__)
154
 
 
 
147
#define dbg_find(fmt, ...)  ubifs_dbg_msg("find", fmt, ##__VA_ARGS__)
155
148
/* Additional mount messages */
156
 
#define dbg_mnt(fmt, ...)   dbg_do_msg(UBIFS_MSG_MNT, fmt, ##__VA_ARGS__)
157
 
 
 
149
#define dbg_mnt(fmt, ...)   ubifs_dbg_msg("mnt", fmt, ##__VA_ARGS__)
158
150
/* Additional I/O messages */
159
 
#define dbg_io(fmt, ...)    dbg_do_msg(UBIFS_MSG_IO, fmt, ##__VA_ARGS__)
160
 
 
 
151
#define dbg_io(fmt, ...)    ubifs_dbg_msg("io", fmt, ##__VA_ARGS__)
161
152
/* Additional commit messages */
162
 
#define dbg_cmt(fmt, ...)   dbg_do_msg(UBIFS_MSG_CMT, fmt, ##__VA_ARGS__)
163
 
 
 
153
#define dbg_cmt(fmt, ...)   ubifs_dbg_msg("cmt", fmt, ##__VA_ARGS__)
164
154
/* Additional budgeting messages */
165
 
#define dbg_budg(fmt, ...)  dbg_do_msg(UBIFS_MSG_BUDG, fmt, ##__VA_ARGS__)
166
 
 
 
155
#define dbg_budg(fmt, ...)  ubifs_dbg_msg("budg", fmt, ##__VA_ARGS__)
167
156
/* Additional log messages */
168
 
#define dbg_log(fmt, ...)   dbg_do_msg(UBIFS_MSG_LOG, fmt, ##__VA_ARGS__)
169
 
 
 
157
#define dbg_log(fmt, ...)   ubifs_dbg_msg("log", fmt, ##__VA_ARGS__)
170
158
/* Additional gc messages */
171
 
#define dbg_gc(fmt, ...)    dbg_do_msg(UBIFS_MSG_GC, fmt, ##__VA_ARGS__)
172
 
 
 
159
#define dbg_gc(fmt, ...)    ubifs_dbg_msg("gc", fmt, ##__VA_ARGS__)
173
160
/* Additional scan messages */
174
 
#define dbg_scan(fmt, ...)  dbg_do_msg(UBIFS_MSG_SCAN, fmt, ##__VA_ARGS__)
175
 
 
 
161
#define dbg_scan(fmt, ...)  ubifs_dbg_msg("scan", fmt, ##__VA_ARGS__)
176
162
/* Additional recovery messages */
177
 
#define dbg_rcvry(fmt, ...) dbg_do_msg(UBIFS_MSG_RCVRY, fmt, ##__VA_ARGS__)
178
 
 
179
 
/*
180
 
 * Debugging message type flags.
181
 
 *
182
 
 * UBIFS_MSG_GEN: general messages
183
 
 * UBIFS_MSG_JNL: journal messages
184
 
 * UBIFS_MSG_MNT: mount messages
185
 
 * UBIFS_MSG_CMT: commit messages
186
 
 * UBIFS_MSG_FIND: LEB find messages
187
 
 * UBIFS_MSG_BUDG: budgeting messages
188
 
 * UBIFS_MSG_GC: garbage collection messages
189
 
 * UBIFS_MSG_TNC: TNC messages
190
 
 * UBIFS_MSG_LP: lprops messages
191
 
 * UBIFS_MSG_IO: I/O messages
192
 
 * UBIFS_MSG_LOG: log messages
193
 
 * UBIFS_MSG_SCAN: scan messages
194
 
 * UBIFS_MSG_RCVRY: recovery messages
195
 
 */
196
 
enum {
197
 
        UBIFS_MSG_GEN   = 0x1,
198
 
        UBIFS_MSG_JNL   = 0x2,
199
 
        UBIFS_MSG_MNT   = 0x4,
200
 
        UBIFS_MSG_CMT   = 0x8,
201
 
        UBIFS_MSG_FIND  = 0x10,
202
 
        UBIFS_MSG_BUDG  = 0x20,
203
 
        UBIFS_MSG_GC    = 0x40,
204
 
        UBIFS_MSG_TNC   = 0x80,
205
 
        UBIFS_MSG_LP    = 0x100,
206
 
        UBIFS_MSG_IO    = 0x200,
207
 
        UBIFS_MSG_LOG   = 0x400,
208
 
        UBIFS_MSG_SCAN  = 0x800,
209
 
        UBIFS_MSG_RCVRY = 0x1000,
210
 
};
 
163
#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__)
211
164
 
212
165
/*
213
166
 * Debugging check flags.
233
186
/*
234
187
 * Special testing flags.
235
188
 *
236
 
 * UBIFS_TST_FORCE_IN_THE_GAPS: force the use of in-the-gaps method
237
189
 * UBIFS_TST_RCVRY: failure mode for recovery testing
238
190
 */
239
191
enum {
240
 
        UBIFS_TST_FORCE_IN_THE_GAPS = 0x2,
241
192
        UBIFS_TST_RCVRY             = 0x4,
242
193
};
243
194
 
262
213
                       int offs);
263
214
void dbg_dump_budget_req(const struct ubifs_budget_req *req);
264
215
void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
265
 
void dbg_dump_budg(struct ubifs_info *c);
 
216
void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
266
217
void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
267
218
void dbg_dump_lprops(struct ubifs_info *c);
268
219
void dbg_dump_lpt_info(struct ubifs_info *c);
304
255
int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
305
256
 
306
257
/* Force the use of in-the-gaps method for testing */
307
 
 
308
 
#define dbg_force_in_the_gaps_enabled \
309
 
        (ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS)
310
 
 
 
258
static inline int dbg_force_in_the_gaps_enabled(void)
 
259
{
 
260
        return ubifs_chk_flags & UBIFS_CHK_GEN;
 
261
}
311
262
int dbg_force_in_the_gaps(void);
312
263
 
313
264
/* Failure mode for recovery testing */
314
 
 
315
265
#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)
316
266
 
317
267
#ifndef UBIFS_DBG_PRESERVE_UBI
318
 
 
319
268
#define ubi_leb_read   dbg_leb_read
320
269
#define ubi_leb_write  dbg_leb_write
321
270
#define ubi_leb_change dbg_leb_change
323
272
#define ubi_leb_unmap  dbg_leb_unmap
324
273
#define ubi_is_mapped  dbg_is_mapped
325
274
#define ubi_leb_map    dbg_leb_map
326
 
 
327
275
#endif
328
276
 
329
277
int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
370
318
                       __func__, __LINE__, current->pid);                      \
371
319
} while (0)
372
320
 
373
 
#define dbg_err(fmt, ...)   do {                                               \
374
 
        if (0)                                                                 \
375
 
                ubifs_err(fmt, ##__VA_ARGS__);                                 \
 
321
#define dbg_err(fmt, ...)   do {                   \
 
322
        if (0)                                     \
 
323
                ubifs_err(fmt, ##__VA_ARGS__);     \
376
324
} while (0)
377
325
 
378
 
#define dbg_msg(fmt, ...) do {                                                 \
379
 
        if (0)                                                                 \
380
 
                printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n",         \
381
 
                       current->pid, __func__, ##__VA_ARGS__);                 \
 
326
#define ubifs_dbg_msg(fmt, ...) do {               \
 
327
        if (0)                                     \
 
328
                pr_debug(fmt "\n", ##__VA_ARGS__); \
382
329
} while (0)
383
330
 
384
331
#define dbg_dump_stack()
385
332
#define ubifs_assert_cmt_locked(c)
386
333
 
387
 
#define dbg_gen(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
388
 
#define dbg_jnl(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
389
 
#define dbg_tnc(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
390
 
#define dbg_lp(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
391
 
#define dbg_find(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
392
 
#define dbg_mnt(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
393
 
#define dbg_io(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
394
 
#define dbg_cmt(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
395
 
#define dbg_budg(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
396
 
#define dbg_log(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
397
 
#define dbg_gc(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
398
 
#define dbg_scan(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
399
 
#define dbg_rcvry(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
 
334
#define dbg_msg(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
335
#define dbg_gen(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
336
#define dbg_jnl(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
337
#define dbg_tnc(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
338
#define dbg_lp(fmt, ...)    ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
339
#define dbg_find(fmt, ...)  ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
340
#define dbg_mnt(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
341
#define dbg_io(fmt, ...)    ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
342
#define dbg_cmt(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
343
#define dbg_budg(fmt, ...)  ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
344
#define dbg_log(fmt, ...)   ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
345
#define dbg_gc(fmt, ...)    ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
346
#define dbg_scan(fmt, ...)  ubifs_dbg_msg(fmt, ##__VA_ARGS__)
 
347
#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
400
348
 
401
349
#define DBGKEY(key)  ((char *)(key))
402
350
#define DBGKEY1(key) ((char *)(key))
420
368
dbg_dump_budget_req(const struct ubifs_budget_req *req)           { return; }
421
369
static inline void
422
370
dbg_dump_lstats(const struct ubifs_lp_stats *lst)                 { return; }
423
 
static inline void dbg_dump_budg(struct ubifs_info *c)            { return; }
 
371
static inline void
 
372
dbg_dump_budg(struct ubifs_info *c,
 
373
              const struct ubifs_budg_info *bi)                   { return; }
424
374
static inline void dbg_dump_lprop(const struct ubifs_info *c,
425
375
                                  const struct ubifs_lprops *lp)  { return; }
426
376
static inline void dbg_dump_lprops(struct ubifs_info *c)          { return; }
482
432
                              struct list_head *head)             { return 0; }
483
433
 
484
434
static inline int dbg_force_in_the_gaps(void)                     { return 0; }
485
 
#define dbg_force_in_the_gaps_enabled 0
486
 
#define dbg_failure_mode              0
 
435
#define dbg_force_in_the_gaps_enabled() 0
 
436
#define dbg_failure_mode                0
487
437
 
488
438
static inline int dbg_debugfs_init(void)                          { return 0; }
489
439
static inline void dbg_debugfs_exit(void)                         { return; }