diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:47:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:47:48 -0400 |
commit | 782c3fb22baa103abbcd30dfc99cad24bb09f1df (patch) | |
tree | acda25cba653a55497f8030323437527258e747f /fs/ubifs/debug.c | |
parent | 60c7b4df82d0ec44fe10487eadec737abea55b34 (diff) | |
parent | 3668b70fcf1fdc6799abf15f70fe3f50f407ec82 (diff) |
Merge tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubifs
Pull ubifs changes from Artem Bityutskiy:
"No big changes for 3.7 in UBIFS:
- Error reporting and debug printing improvements
- Power cut emulation fixes
- Minor cleanups"
Fix trivial conflict in fs/ubifs/debug.c due to the user namespace
changes.
* tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubifs:
UBIFS: print less
UBIFS: use pr_ helper instead of printk
UBIFS: comply with coding style
UBIFS: use __aligned() attribute
UBIFS: remove __DATE__ and __TIME__
UBIFS: fix power cut emulation for mtdram
UBIFS: improve scanning debug output
UBIFS: always print full error reports
UBIFS: print PID in debug messages
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 633 |
1 files changed, 270 insertions, 363 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 340d1afc1302..62911637e12f 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -219,15 +219,15 @@ const char *dbg_jhead(int jhead) | |||
219 | 219 | ||
220 | static void dump_ch(const struct ubifs_ch *ch) | 220 | static void dump_ch(const struct ubifs_ch *ch) |
221 | { | 221 | { |
222 | printk(KERN_ERR "\tmagic %#x\n", le32_to_cpu(ch->magic)); | 222 | pr_err("\tmagic %#x\n", le32_to_cpu(ch->magic)); |
223 | printk(KERN_ERR "\tcrc %#x\n", le32_to_cpu(ch->crc)); | 223 | pr_err("\tcrc %#x\n", le32_to_cpu(ch->crc)); |
224 | printk(KERN_ERR "\tnode_type %d (%s)\n", ch->node_type, | 224 | pr_err("\tnode_type %d (%s)\n", ch->node_type, |
225 | dbg_ntype(ch->node_type)); | 225 | dbg_ntype(ch->node_type)); |
226 | printk(KERN_ERR "\tgroup_type %d (%s)\n", ch->group_type, | 226 | pr_err("\tgroup_type %d (%s)\n", ch->group_type, |
227 | dbg_gtype(ch->group_type)); | 227 | dbg_gtype(ch->group_type)); |
228 | printk(KERN_ERR "\tsqnum %llu\n", | 228 | pr_err("\tsqnum %llu\n", |
229 | (unsigned long long)le64_to_cpu(ch->sqnum)); | 229 | (unsigned long long)le64_to_cpu(ch->sqnum)); |
230 | printk(KERN_ERR "\tlen %u\n", le32_to_cpu(ch->len)); | 230 | pr_err("\tlen %u\n", le32_to_cpu(ch->len)); |
231 | } | 231 | } |
232 | 232 | ||
233 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) | 233 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) |
@@ -238,43 +238,43 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) | |||
238 | struct ubifs_dent_node *dent, *pdent = NULL; | 238 | struct ubifs_dent_node *dent, *pdent = NULL; |
239 | int count = 2; | 239 | int count = 2; |
240 | 240 | ||
241 | printk(KERN_ERR "Dump in-memory inode:"); | 241 | pr_err("Dump in-memory inode:"); |
242 | printk(KERN_ERR "\tinode %lu\n", inode->i_ino); | 242 | pr_err("\tinode %lu\n", inode->i_ino); |
243 | printk(KERN_ERR "\tsize %llu\n", | 243 | pr_err("\tsize %llu\n", |
244 | (unsigned long long)i_size_read(inode)); | 244 | (unsigned long long)i_size_read(inode)); |
245 | printk(KERN_ERR "\tnlink %u\n", inode->i_nlink); | 245 | pr_err("\tnlink %u\n", inode->i_nlink); |
246 | printk(KERN_ERR "\tuid %u\n", (unsigned int)i_uid_read(inode)); | 246 | pr_err("\tuid %u\n", (unsigned int)i_uid_read(inode)); |
247 | printk(KERN_ERR "\tgid %u\n", (unsigned int)i_gid_read(inode)); | 247 | pr_err("\tgid %u\n", (unsigned int)i_gid_read(inode)); |
248 | printk(KERN_ERR "\tatime %u.%u\n", | 248 | pr_err("\tatime %u.%u\n", |
249 | (unsigned int)inode->i_atime.tv_sec, | 249 | (unsigned int)inode->i_atime.tv_sec, |
250 | (unsigned int)inode->i_atime.tv_nsec); | 250 | (unsigned int)inode->i_atime.tv_nsec); |
251 | printk(KERN_ERR "\tmtime %u.%u\n", | 251 | pr_err("\tmtime %u.%u\n", |
252 | (unsigned int)inode->i_mtime.tv_sec, | 252 | (unsigned int)inode->i_mtime.tv_sec, |
253 | (unsigned int)inode->i_mtime.tv_nsec); | 253 | (unsigned int)inode->i_mtime.tv_nsec); |
254 | printk(KERN_ERR "\tctime %u.%u\n", | 254 | pr_err("\tctime %u.%u\n", |
255 | (unsigned int)inode->i_ctime.tv_sec, | 255 | (unsigned int)inode->i_ctime.tv_sec, |
256 | (unsigned int)inode->i_ctime.tv_nsec); | 256 | (unsigned int)inode->i_ctime.tv_nsec); |
257 | printk(KERN_ERR "\tcreat_sqnum %llu\n", ui->creat_sqnum); | 257 | pr_err("\tcreat_sqnum %llu\n", ui->creat_sqnum); |
258 | printk(KERN_ERR "\txattr_size %u\n", ui->xattr_size); | 258 | pr_err("\txattr_size %u\n", ui->xattr_size); |
259 | printk(KERN_ERR "\txattr_cnt %u\n", ui->xattr_cnt); | 259 | pr_err("\txattr_cnt %u\n", ui->xattr_cnt); |
260 | printk(KERN_ERR "\txattr_names %u\n", ui->xattr_names); | 260 | pr_err("\txattr_names %u\n", ui->xattr_names); |
261 | printk(KERN_ERR "\tdirty %u\n", ui->dirty); | 261 | pr_err("\tdirty %u\n", ui->dirty); |
262 | printk(KERN_ERR "\txattr %u\n", ui->xattr); | 262 | pr_err("\txattr %u\n", ui->xattr); |
263 | printk(KERN_ERR "\tbulk_read %u\n", ui->xattr); | 263 | pr_err("\tbulk_read %u\n", ui->xattr); |
264 | printk(KERN_ERR "\tsynced_i_size %llu\n", | 264 | pr_err("\tsynced_i_size %llu\n", |
265 | (unsigned long long)ui->synced_i_size); | 265 | (unsigned long long)ui->synced_i_size); |
266 | printk(KERN_ERR "\tui_size %llu\n", | 266 | pr_err("\tui_size %llu\n", |
267 | (unsigned long long)ui->ui_size); | 267 | (unsigned long long)ui->ui_size); |
268 | printk(KERN_ERR "\tflags %d\n", ui->flags); | 268 | pr_err("\tflags %d\n", ui->flags); |
269 | printk(KERN_ERR "\tcompr_type %d\n", ui->compr_type); | 269 | pr_err("\tcompr_type %d\n", ui->compr_type); |
270 | printk(KERN_ERR "\tlast_page_read %lu\n", ui->last_page_read); | 270 | pr_err("\tlast_page_read %lu\n", ui->last_page_read); |
271 | printk(KERN_ERR "\tread_in_a_row %lu\n", ui->read_in_a_row); | 271 | pr_err("\tread_in_a_row %lu\n", ui->read_in_a_row); |
272 | printk(KERN_ERR "\tdata_len %d\n", ui->data_len); | 272 | pr_err("\tdata_len %d\n", ui->data_len); |
273 | 273 | ||
274 | if (!S_ISDIR(inode->i_mode)) | 274 | if (!S_ISDIR(inode->i_mode)) |
275 | return; | 275 | return; |
276 | 276 | ||
277 | printk(KERN_ERR "List of directory entries:\n"); | 277 | pr_err("List of directory entries:\n"); |
278 | ubifs_assert(!mutex_is_locked(&c->tnc_mutex)); | 278 | ubifs_assert(!mutex_is_locked(&c->tnc_mutex)); |
279 | 279 | ||
280 | lowest_dent_key(c, &key, inode->i_ino); | 280 | lowest_dent_key(c, &key, inode->i_ino); |
@@ -282,11 +282,11 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) | |||
282 | dent = ubifs_tnc_next_ent(c, &key, &nm); | 282 | dent = ubifs_tnc_next_ent(c, &key, &nm); |
283 | if (IS_ERR(dent)) { | 283 | if (IS_ERR(dent)) { |
284 | if (PTR_ERR(dent) != -ENOENT) | 284 | if (PTR_ERR(dent) != -ENOENT) |
285 | printk(KERN_ERR "error %ld\n", PTR_ERR(dent)); | 285 | pr_err("error %ld\n", PTR_ERR(dent)); |
286 | break; | 286 | break; |
287 | } | 287 | } |
288 | 288 | ||
289 | printk(KERN_ERR "\t%d: %s (%s)\n", | 289 | pr_err("\t%d: %s (%s)\n", |
290 | count++, dent->name, get_dent_type(dent->type)); | 290 | count++, dent->name, get_dent_type(dent->type)); |
291 | 291 | ||
292 | nm.name = dent->name; | 292 | nm.name = dent->name; |
@@ -305,12 +305,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
305 | const struct ubifs_ch *ch = node; | 305 | const struct ubifs_ch *ch = node; |
306 | char key_buf[DBG_KEY_BUF_LEN]; | 306 | char key_buf[DBG_KEY_BUF_LEN]; |
307 | 307 | ||
308 | if (dbg_is_tst_rcvry(c)) | ||
309 | return; | ||
310 | |||
311 | /* If the magic is incorrect, just hexdump the first bytes */ | 308 | /* If the magic is incorrect, just hexdump the first bytes */ |
312 | if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) { | 309 | if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) { |
313 | printk(KERN_ERR "Not a node, first %zu bytes:", UBIFS_CH_SZ); | 310 | pr_err("Not a node, first %zu bytes:", UBIFS_CH_SZ); |
314 | print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1, | 311 | print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1, |
315 | (void *)node, UBIFS_CH_SZ, 1); | 312 | (void *)node, UBIFS_CH_SZ, 1); |
316 | return; | 313 | return; |
@@ -324,8 +321,7 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
324 | { | 321 | { |
325 | const struct ubifs_pad_node *pad = node; | 322 | const struct ubifs_pad_node *pad = node; |
326 | 323 | ||
327 | printk(KERN_ERR "\tpad_len %u\n", | 324 | pr_err("\tpad_len %u\n", le32_to_cpu(pad->pad_len)); |
328 | le32_to_cpu(pad->pad_len)); | ||
329 | break; | 325 | break; |
330 | } | 326 | } |
331 | case UBIFS_SB_NODE: | 327 | case UBIFS_SB_NODE: |
@@ -333,112 +329,77 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
333 | const struct ubifs_sb_node *sup = node; | 329 | const struct ubifs_sb_node *sup = node; |
334 | unsigned int sup_flags = le32_to_cpu(sup->flags); | 330 | unsigned int sup_flags = le32_to_cpu(sup->flags); |
335 | 331 | ||
336 | printk(KERN_ERR "\tkey_hash %d (%s)\n", | 332 | pr_err("\tkey_hash %d (%s)\n", |
337 | (int)sup->key_hash, get_key_hash(sup->key_hash)); | 333 | (int)sup->key_hash, get_key_hash(sup->key_hash)); |
338 | printk(KERN_ERR "\tkey_fmt %d (%s)\n", | 334 | pr_err("\tkey_fmt %d (%s)\n", |
339 | (int)sup->key_fmt, get_key_fmt(sup->key_fmt)); | 335 | (int)sup->key_fmt, get_key_fmt(sup->key_fmt)); |
340 | printk(KERN_ERR "\tflags %#x\n", sup_flags); | 336 | pr_err("\tflags %#x\n", sup_flags); |
341 | printk(KERN_ERR "\t big_lpt %u\n", | 337 | pr_err("\t big_lpt %u\n", |
342 | !!(sup_flags & UBIFS_FLG_BIGLPT)); | 338 | !!(sup_flags & UBIFS_FLG_BIGLPT)); |
343 | printk(KERN_ERR "\t space_fixup %u\n", | 339 | pr_err("\t space_fixup %u\n", |
344 | !!(sup_flags & UBIFS_FLG_SPACE_FIXUP)); | 340 | !!(sup_flags & UBIFS_FLG_SPACE_FIXUP)); |
345 | printk(KERN_ERR "\tmin_io_size %u\n", | 341 | pr_err("\tmin_io_size %u\n", le32_to_cpu(sup->min_io_size)); |
346 | le32_to_cpu(sup->min_io_size)); | 342 | pr_err("\tleb_size %u\n", le32_to_cpu(sup->leb_size)); |
347 | printk(KERN_ERR "\tleb_size %u\n", | 343 | pr_err("\tleb_cnt %u\n", le32_to_cpu(sup->leb_cnt)); |
348 | le32_to_cpu(sup->leb_size)); | 344 | pr_err("\tmax_leb_cnt %u\n", le32_to_cpu(sup->max_leb_cnt)); |
349 | printk(KERN_ERR "\tleb_cnt %u\n", | 345 | pr_err("\tmax_bud_bytes %llu\n", |
350 | le32_to_cpu(sup->leb_cnt)); | ||
351 | printk(KERN_ERR "\tmax_leb_cnt %u\n", | ||
352 | le32_to_cpu(sup->max_leb_cnt)); | ||
353 | printk(KERN_ERR "\tmax_bud_bytes %llu\n", | ||
354 | (unsigned long long)le64_to_cpu(sup->max_bud_bytes)); | 346 | (unsigned long long)le64_to_cpu(sup->max_bud_bytes)); |
355 | printk(KERN_ERR "\tlog_lebs %u\n", | 347 | pr_err("\tlog_lebs %u\n", le32_to_cpu(sup->log_lebs)); |
356 | le32_to_cpu(sup->log_lebs)); | 348 | pr_err("\tlpt_lebs %u\n", le32_to_cpu(sup->lpt_lebs)); |
357 | printk(KERN_ERR "\tlpt_lebs %u\n", | 349 | pr_err("\torph_lebs %u\n", le32_to_cpu(sup->orph_lebs)); |
358 | le32_to_cpu(sup->lpt_lebs)); | 350 | pr_err("\tjhead_cnt %u\n", le32_to_cpu(sup->jhead_cnt)); |
359 | printk(KERN_ERR "\torph_lebs %u\n", | 351 | pr_err("\tfanout %u\n", le32_to_cpu(sup->fanout)); |
360 | le32_to_cpu(sup->orph_lebs)); | 352 | pr_err("\tlsave_cnt %u\n", le32_to_cpu(sup->lsave_cnt)); |
361 | printk(KERN_ERR "\tjhead_cnt %u\n", | 353 | pr_err("\tdefault_compr %u\n", |
362 | le32_to_cpu(sup->jhead_cnt)); | ||
363 | printk(KERN_ERR "\tfanout %u\n", | ||
364 | le32_to_cpu(sup->fanout)); | ||
365 | printk(KERN_ERR "\tlsave_cnt %u\n", | ||
366 | le32_to_cpu(sup->lsave_cnt)); | ||
367 | printk(KERN_ERR "\tdefault_compr %u\n", | ||
368 | (int)le16_to_cpu(sup->default_compr)); | 354 | (int)le16_to_cpu(sup->default_compr)); |
369 | printk(KERN_ERR "\trp_size %llu\n", | 355 | pr_err("\trp_size %llu\n", |
370 | (unsigned long long)le64_to_cpu(sup->rp_size)); | 356 | (unsigned long long)le64_to_cpu(sup->rp_size)); |
371 | printk(KERN_ERR "\trp_uid %u\n", | 357 | pr_err("\trp_uid %u\n", le32_to_cpu(sup->rp_uid)); |
372 | le32_to_cpu(sup->rp_uid)); | 358 | pr_err("\trp_gid %u\n", le32_to_cpu(sup->rp_gid)); |
373 | printk(KERN_ERR "\trp_gid %u\n", | 359 | pr_err("\tfmt_version %u\n", le32_to_cpu(sup->fmt_version)); |
374 | le32_to_cpu(sup->rp_gid)); | 360 | pr_err("\ttime_gran %u\n", le32_to_cpu(sup->time_gran)); |
375 | printk(KERN_ERR "\tfmt_version %u\n", | 361 | pr_err("\tUUID %pUB\n", sup->uuid); |
376 | le32_to_cpu(sup->fmt_version)); | ||
377 | printk(KERN_ERR "\ttime_gran %u\n", | ||
378 | le32_to_cpu(sup->time_gran)); | ||
379 | printk(KERN_ERR "\tUUID %pUB\n", | ||
380 | sup->uuid); | ||
381 | break; | 362 | break; |
382 | } | 363 | } |
383 | case UBIFS_MST_NODE: | 364 | case UBIFS_MST_NODE: |
384 | { | 365 | { |
385 | const struct ubifs_mst_node *mst = node; | 366 | const struct ubifs_mst_node *mst = node; |
386 | 367 | ||
387 | printk(KERN_ERR "\thighest_inum %llu\n", | 368 | pr_err("\thighest_inum %llu\n", |
388 | (unsigned long long)le64_to_cpu(mst->highest_inum)); | 369 | (unsigned long long)le64_to_cpu(mst->highest_inum)); |
389 | printk(KERN_ERR "\tcommit number %llu\n", | 370 | pr_err("\tcommit number %llu\n", |
390 | (unsigned long long)le64_to_cpu(mst->cmt_no)); | 371 | (unsigned long long)le64_to_cpu(mst->cmt_no)); |
391 | printk(KERN_ERR "\tflags %#x\n", | 372 | pr_err("\tflags %#x\n", le32_to_cpu(mst->flags)); |
392 | le32_to_cpu(mst->flags)); | 373 | pr_err("\tlog_lnum %u\n", le32_to_cpu(mst->log_lnum)); |
393 | printk(KERN_ERR "\tlog_lnum %u\n", | 374 | pr_err("\troot_lnum %u\n", le32_to_cpu(mst->root_lnum)); |
394 | le32_to_cpu(mst->log_lnum)); | 375 | pr_err("\troot_offs %u\n", le32_to_cpu(mst->root_offs)); |
395 | printk(KERN_ERR "\troot_lnum %u\n", | 376 | pr_err("\troot_len %u\n", le32_to_cpu(mst->root_len)); |
396 | le32_to_cpu(mst->root_lnum)); | 377 | pr_err("\tgc_lnum %u\n", le32_to_cpu(mst->gc_lnum)); |
397 | printk(KERN_ERR "\troot_offs %u\n", | 378 | pr_err("\tihead_lnum %u\n", le32_to_cpu(mst->ihead_lnum)); |
398 | le32_to_cpu(mst->root_offs)); | 379 | pr_err("\tihead_offs %u\n", le32_to_cpu(mst->ihead_offs)); |
399 | printk(KERN_ERR "\troot_len %u\n", | 380 | pr_err("\tindex_size %llu\n", |
400 | le32_to_cpu(mst->root_len)); | ||
401 | printk(KERN_ERR "\tgc_lnum %u\n", | ||
402 | le32_to_cpu(mst->gc_lnum)); | ||
403 | printk(KERN_ERR "\tihead_lnum %u\n", | ||
404 | le32_to_cpu(mst->ihead_lnum)); | ||
405 | printk(KERN_ERR "\tihead_offs %u\n", | ||
406 | le32_to_cpu(mst->ihead_offs)); | ||
407 | printk(KERN_ERR "\tindex_size %llu\n", | ||
408 | (unsigned long long)le64_to_cpu(mst->index_size)); | 381 | (unsigned long long)le64_to_cpu(mst->index_size)); |
409 | printk(KERN_ERR "\tlpt_lnum %u\n", | 382 | pr_err("\tlpt_lnum %u\n", le32_to_cpu(mst->lpt_lnum)); |
410 | le32_to_cpu(mst->lpt_lnum)); | 383 | pr_err("\tlpt_offs %u\n", le32_to_cpu(mst->lpt_offs)); |
411 | printk(KERN_ERR "\tlpt_offs %u\n", | 384 | pr_err("\tnhead_lnum %u\n", le32_to_cpu(mst->nhead_lnum)); |
412 | le32_to_cpu(mst->lpt_offs)); | 385 | pr_err("\tnhead_offs %u\n", le32_to_cpu(mst->nhead_offs)); |
413 | printk(KERN_ERR "\tnhead_lnum %u\n", | 386 | pr_err("\tltab_lnum %u\n", le32_to_cpu(mst->ltab_lnum)); |
414 | le32_to_cpu(mst->nhead_lnum)); | 387 | pr_err("\tltab_offs %u\n", le32_to_cpu(mst->ltab_offs)); |
415 | printk(KERN_ERR "\tnhead_offs %u\n", | 388 | pr_err("\tlsave_lnum %u\n", le32_to_cpu(mst->lsave_lnum)); |
416 | le32_to_cpu(mst->nhead_offs)); | 389 | pr_err("\tlsave_offs %u\n", le32_to_cpu(mst->lsave_offs)); |
417 | printk(KERN_ERR "\tltab_lnum %u\n", | 390 | pr_err("\tlscan_lnum %u\n", le32_to_cpu(mst->lscan_lnum)); |
418 | le32_to_cpu(mst->ltab_lnum)); | 391 | pr_err("\tleb_cnt %u\n", le32_to_cpu(mst->leb_cnt)); |
419 | printk(KERN_ERR "\tltab_offs %u\n", | 392 | pr_err("\tempty_lebs %u\n", le32_to_cpu(mst->empty_lebs)); |
420 | le32_to_cpu(mst->ltab_offs)); | 393 | pr_err("\tidx_lebs %u\n", le32_to_cpu(mst->idx_lebs)); |
421 | printk(KERN_ERR "\tlsave_lnum %u\n", | 394 | pr_err("\ttotal_free %llu\n", |
422 | le32_to_cpu(mst->lsave_lnum)); | ||
423 | printk(KERN_ERR "\tlsave_offs %u\n", | ||
424 | le32_to_cpu(mst->lsave_offs)); | ||
425 | printk(KERN_ERR "\tlscan_lnum %u\n", | ||
426 | le32_to_cpu(mst->lscan_lnum)); | ||
427 | printk(KERN_ERR "\tleb_cnt %u\n", | ||
428 | le32_to_cpu(mst->leb_cnt)); | ||
429 | printk(KERN_ERR "\tempty_lebs %u\n", | ||
430 | le32_to_cpu(mst->empty_lebs)); | ||
431 | printk(KERN_ERR "\tidx_lebs %u\n", | ||
432 | le32_to_cpu(mst->idx_lebs)); | ||
433 | printk(KERN_ERR "\ttotal_free %llu\n", | ||
434 | (unsigned long long)le64_to_cpu(mst->total_free)); | 395 | (unsigned long long)le64_to_cpu(mst->total_free)); |
435 | printk(KERN_ERR "\ttotal_dirty %llu\n", | 396 | pr_err("\ttotal_dirty %llu\n", |
436 | (unsigned long long)le64_to_cpu(mst->total_dirty)); | 397 | (unsigned long long)le64_to_cpu(mst->total_dirty)); |
437 | printk(KERN_ERR "\ttotal_used %llu\n", | 398 | pr_err("\ttotal_used %llu\n", |
438 | (unsigned long long)le64_to_cpu(mst->total_used)); | 399 | (unsigned long long)le64_to_cpu(mst->total_used)); |
439 | printk(KERN_ERR "\ttotal_dead %llu\n", | 400 | pr_err("\ttotal_dead %llu\n", |
440 | (unsigned long long)le64_to_cpu(mst->total_dead)); | 401 | (unsigned long long)le64_to_cpu(mst->total_dead)); |
441 | printk(KERN_ERR "\ttotal_dark %llu\n", | 402 | pr_err("\ttotal_dark %llu\n", |
442 | (unsigned long long)le64_to_cpu(mst->total_dark)); | 403 | (unsigned long long)le64_to_cpu(mst->total_dark)); |
443 | break; | 404 | break; |
444 | } | 405 | } |
@@ -446,12 +407,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
446 | { | 407 | { |
447 | const struct ubifs_ref_node *ref = node; | 408 | const struct ubifs_ref_node *ref = node; |
448 | 409 | ||
449 | printk(KERN_ERR "\tlnum %u\n", | 410 | pr_err("\tlnum %u\n", le32_to_cpu(ref->lnum)); |
450 | le32_to_cpu(ref->lnum)); | 411 | pr_err("\toffs %u\n", le32_to_cpu(ref->offs)); |
451 | printk(KERN_ERR "\toffs %u\n", | 412 | pr_err("\tjhead %u\n", le32_to_cpu(ref->jhead)); |
452 | le32_to_cpu(ref->offs)); | ||
453 | printk(KERN_ERR "\tjhead %u\n", | ||
454 | le32_to_cpu(ref->jhead)); | ||
455 | break; | 413 | break; |
456 | } | 414 | } |
457 | case UBIFS_INO_NODE: | 415 | case UBIFS_INO_NODE: |
@@ -459,41 +417,32 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
459 | const struct ubifs_ino_node *ino = node; | 417 | const struct ubifs_ino_node *ino = node; |
460 | 418 | ||
461 | key_read(c, &ino->key, &key); | 419 | key_read(c, &ino->key, &key); |
462 | printk(KERN_ERR "\tkey %s\n", | 420 | pr_err("\tkey %s\n", |
463 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 421 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
464 | printk(KERN_ERR "\tcreat_sqnum %llu\n", | 422 | pr_err("\tcreat_sqnum %llu\n", |
465 | (unsigned long long)le64_to_cpu(ino->creat_sqnum)); | 423 | (unsigned long long)le64_to_cpu(ino->creat_sqnum)); |
466 | printk(KERN_ERR "\tsize %llu\n", | 424 | pr_err("\tsize %llu\n", |
467 | (unsigned long long)le64_to_cpu(ino->size)); | 425 | (unsigned long long)le64_to_cpu(ino->size)); |
468 | printk(KERN_ERR "\tnlink %u\n", | 426 | pr_err("\tnlink %u\n", le32_to_cpu(ino->nlink)); |
469 | le32_to_cpu(ino->nlink)); | 427 | pr_err("\tatime %lld.%u\n", |
470 | printk(KERN_ERR "\tatime %lld.%u\n", | ||
471 | (long long)le64_to_cpu(ino->atime_sec), | 428 | (long long)le64_to_cpu(ino->atime_sec), |
472 | le32_to_cpu(ino->atime_nsec)); | 429 | le32_to_cpu(ino->atime_nsec)); |
473 | printk(KERN_ERR "\tmtime %lld.%u\n", | 430 | pr_err("\tmtime %lld.%u\n", |
474 | (long long)le64_to_cpu(ino->mtime_sec), | 431 | (long long)le64_to_cpu(ino->mtime_sec), |
475 | le32_to_cpu(ino->mtime_nsec)); | 432 | le32_to_cpu(ino->mtime_nsec)); |
476 | printk(KERN_ERR "\tctime %lld.%u\n", | 433 | pr_err("\tctime %lld.%u\n", |
477 | (long long)le64_to_cpu(ino->ctime_sec), | 434 | (long long)le64_to_cpu(ino->ctime_sec), |
478 | le32_to_cpu(ino->ctime_nsec)); | 435 | le32_to_cpu(ino->ctime_nsec)); |
479 | printk(KERN_ERR "\tuid %u\n", | 436 | pr_err("\tuid %u\n", le32_to_cpu(ino->uid)); |
480 | le32_to_cpu(ino->uid)); | 437 | pr_err("\tgid %u\n", le32_to_cpu(ino->gid)); |
481 | printk(KERN_ERR "\tgid %u\n", | 438 | pr_err("\tmode %u\n", le32_to_cpu(ino->mode)); |
482 | le32_to_cpu(ino->gid)); | 439 | pr_err("\tflags %#x\n", le32_to_cpu(ino->flags)); |
483 | printk(KERN_ERR "\tmode %u\n", | 440 | pr_err("\txattr_cnt %u\n", le32_to_cpu(ino->xattr_cnt)); |
484 | le32_to_cpu(ino->mode)); | 441 | pr_err("\txattr_size %u\n", le32_to_cpu(ino->xattr_size)); |
485 | printk(KERN_ERR "\tflags %#x\n", | 442 | pr_err("\txattr_names %u\n", le32_to_cpu(ino->xattr_names)); |
486 | le32_to_cpu(ino->flags)); | 443 | pr_err("\tcompr_type %#x\n", |
487 | printk(KERN_ERR "\txattr_cnt %u\n", | ||
488 | le32_to_cpu(ino->xattr_cnt)); | ||
489 | printk(KERN_ERR "\txattr_size %u\n", | ||
490 | le32_to_cpu(ino->xattr_size)); | ||
491 | printk(KERN_ERR "\txattr_names %u\n", | ||
492 | le32_to_cpu(ino->xattr_names)); | ||
493 | printk(KERN_ERR "\tcompr_type %#x\n", | ||
494 | (int)le16_to_cpu(ino->compr_type)); | 444 | (int)le16_to_cpu(ino->compr_type)); |
495 | printk(KERN_ERR "\tdata len %u\n", | 445 | pr_err("\tdata len %u\n", le32_to_cpu(ino->data_len)); |
496 | le32_to_cpu(ino->data_len)); | ||
497 | break; | 446 | break; |
498 | } | 447 | } |
499 | case UBIFS_DENT_NODE: | 448 | case UBIFS_DENT_NODE: |
@@ -503,22 +452,21 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
503 | int nlen = le16_to_cpu(dent->nlen); | 452 | int nlen = le16_to_cpu(dent->nlen); |
504 | 453 | ||
505 | key_read(c, &dent->key, &key); | 454 | key_read(c, &dent->key, &key); |
506 | printk(KERN_ERR "\tkey %s\n", | 455 | pr_err("\tkey %s\n", |
507 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 456 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
508 | printk(KERN_ERR "\tinum %llu\n", | 457 | pr_err("\tinum %llu\n", |
509 | (unsigned long long)le64_to_cpu(dent->inum)); | 458 | (unsigned long long)le64_to_cpu(dent->inum)); |
510 | printk(KERN_ERR "\ttype %d\n", (int)dent->type); | 459 | pr_err("\ttype %d\n", (int)dent->type); |
511 | printk(KERN_ERR "\tnlen %d\n", nlen); | 460 | pr_err("\tnlen %d\n", nlen); |
512 | printk(KERN_ERR "\tname "); | 461 | pr_err("\tname "); |
513 | 462 | ||
514 | if (nlen > UBIFS_MAX_NLEN) | 463 | if (nlen > UBIFS_MAX_NLEN) |
515 | printk(KERN_ERR "(bad name length, not printing, " | 464 | pr_err("(bad name length, not printing, bad or corrupted node)"); |
516 | "bad or corrupted node)"); | ||
517 | else { | 465 | else { |
518 | for (i = 0; i < nlen && dent->name[i]; i++) | 466 | for (i = 0; i < nlen && dent->name[i]; i++) |
519 | printk(KERN_CONT "%c", dent->name[i]); | 467 | pr_cont("%c", dent->name[i]); |
520 | } | 468 | } |
521 | printk(KERN_CONT "\n"); | 469 | pr_cont("\n"); |
522 | 470 | ||
523 | break; | 471 | break; |
524 | } | 472 | } |
@@ -528,15 +476,13 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
528 | int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ; | 476 | int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ; |
529 | 477 | ||
530 | key_read(c, &dn->key, &key); | 478 | key_read(c, &dn->key, &key); |
531 | printk(KERN_ERR "\tkey %s\n", | 479 | pr_err("\tkey %s\n", |
532 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 480 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
533 | printk(KERN_ERR "\tsize %u\n", | 481 | pr_err("\tsize %u\n", le32_to_cpu(dn->size)); |
534 | le32_to_cpu(dn->size)); | 482 | pr_err("\tcompr_typ %d\n", |
535 | printk(KERN_ERR "\tcompr_typ %d\n", | ||
536 | (int)le16_to_cpu(dn->compr_type)); | 483 | (int)le16_to_cpu(dn->compr_type)); |
537 | printk(KERN_ERR "\tdata size %d\n", | 484 | pr_err("\tdata size %d\n", dlen); |
538 | dlen); | 485 | pr_err("\tdata:\n"); |
539 | printk(KERN_ERR "\tdata:\n"); | ||
540 | print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1, | 486 | print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1, |
541 | (void *)&dn->data, dlen, 0); | 487 | (void *)&dn->data, dlen, 0); |
542 | break; | 488 | break; |
@@ -545,11 +491,10 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
545 | { | 491 | { |
546 | const struct ubifs_trun_node *trun = node; | 492 | const struct ubifs_trun_node *trun = node; |
547 | 493 | ||
548 | printk(KERN_ERR "\tinum %u\n", | 494 | pr_err("\tinum %u\n", le32_to_cpu(trun->inum)); |
549 | le32_to_cpu(trun->inum)); | 495 | pr_err("\told_size %llu\n", |
550 | printk(KERN_ERR "\told_size %llu\n", | ||
551 | (unsigned long long)le64_to_cpu(trun->old_size)); | 496 | (unsigned long long)le64_to_cpu(trun->old_size)); |
552 | printk(KERN_ERR "\tnew_size %llu\n", | 497 | pr_err("\tnew_size %llu\n", |
553 | (unsigned long long)le64_to_cpu(trun->new_size)); | 498 | (unsigned long long)le64_to_cpu(trun->new_size)); |
554 | break; | 499 | break; |
555 | } | 500 | } |
@@ -558,17 +503,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
558 | const struct ubifs_idx_node *idx = node; | 503 | const struct ubifs_idx_node *idx = node; |
559 | 504 | ||
560 | n = le16_to_cpu(idx->child_cnt); | 505 | n = le16_to_cpu(idx->child_cnt); |
561 | printk(KERN_ERR "\tchild_cnt %d\n", n); | 506 | pr_err("\tchild_cnt %d\n", n); |
562 | printk(KERN_ERR "\tlevel %d\n", | 507 | pr_err("\tlevel %d\n", (int)le16_to_cpu(idx->level)); |
563 | (int)le16_to_cpu(idx->level)); | 508 | pr_err("\tBranches:\n"); |
564 | printk(KERN_ERR "\tBranches:\n"); | ||
565 | 509 | ||
566 | for (i = 0; i < n && i < c->fanout - 1; i++) { | 510 | for (i = 0; i < n && i < c->fanout - 1; i++) { |
567 | const struct ubifs_branch *br; | 511 | const struct ubifs_branch *br; |
568 | 512 | ||
569 | br = ubifs_idx_branch(c, idx, i); | 513 | br = ubifs_idx_branch(c, idx, i); |
570 | key_read(c, &br->key, &key); | 514 | key_read(c, &br->key, &key); |
571 | printk(KERN_ERR "\t%d: LEB %d:%d len %d key %s\n", | 515 | pr_err("\t%d: LEB %d:%d len %d key %s\n", |
572 | i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), | 516 | i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), |
573 | le32_to_cpu(br->len), | 517 | le32_to_cpu(br->len), |
574 | dbg_snprintf_key(c, &key, key_buf, | 518 | dbg_snprintf_key(c, &key, key_buf, |
@@ -582,20 +526,20 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
582 | { | 526 | { |
583 | const struct ubifs_orph_node *orph = node; | 527 | const struct ubifs_orph_node *orph = node; |
584 | 528 | ||
585 | printk(KERN_ERR "\tcommit number %llu\n", | 529 | pr_err("\tcommit number %llu\n", |
586 | (unsigned long long) | 530 | (unsigned long long) |
587 | le64_to_cpu(orph->cmt_no) & LLONG_MAX); | 531 | le64_to_cpu(orph->cmt_no) & LLONG_MAX); |
588 | printk(KERN_ERR "\tlast node flag %llu\n", | 532 | pr_err("\tlast node flag %llu\n", |
589 | (unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63); | 533 | (unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63); |
590 | n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3; | 534 | n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3; |
591 | printk(KERN_ERR "\t%d orphan inode numbers:\n", n); | 535 | pr_err("\t%d orphan inode numbers:\n", n); |
592 | for (i = 0; i < n; i++) | 536 | for (i = 0; i < n; i++) |
593 | printk(KERN_ERR "\t ino %llu\n", | 537 | pr_err("\t ino %llu\n", |
594 | (unsigned long long)le64_to_cpu(orph->inos[i])); | 538 | (unsigned long long)le64_to_cpu(orph->inos[i])); |
595 | break; | 539 | break; |
596 | } | 540 | } |
597 | default: | 541 | default: |
598 | printk(KERN_ERR "node type %d was not recognized\n", | 542 | pr_err("node type %d was not recognized\n", |
599 | (int)ch->node_type); | 543 | (int)ch->node_type); |
600 | } | 544 | } |
601 | spin_unlock(&dbg_lock); | 545 | spin_unlock(&dbg_lock); |
@@ -604,16 +548,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
604 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req) | 548 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req) |
605 | { | 549 | { |
606 | spin_lock(&dbg_lock); | 550 | spin_lock(&dbg_lock); |
607 | printk(KERN_ERR "Budgeting request: new_ino %d, dirtied_ino %d\n", | 551 | pr_err("Budgeting request: new_ino %d, dirtied_ino %d\n", |
608 | req->new_ino, req->dirtied_ino); | 552 | req->new_ino, req->dirtied_ino); |
609 | printk(KERN_ERR "\tnew_ino_d %d, dirtied_ino_d %d\n", | 553 | pr_err("\tnew_ino_d %d, dirtied_ino_d %d\n", |
610 | req->new_ino_d, req->dirtied_ino_d); | 554 | req->new_ino_d, req->dirtied_ino_d); |
611 | printk(KERN_ERR "\tnew_page %d, dirtied_page %d\n", | 555 | pr_err("\tnew_page %d, dirtied_page %d\n", |
612 | req->new_page, req->dirtied_page); | 556 | req->new_page, req->dirtied_page); |
613 | printk(KERN_ERR "\tnew_dent %d, mod_dent %d\n", | 557 | pr_err("\tnew_dent %d, mod_dent %d\n", |
614 | req->new_dent, req->mod_dent); | 558 | req->new_dent, req->mod_dent); |
615 | printk(KERN_ERR "\tidx_growth %d\n", req->idx_growth); | 559 | pr_err("\tidx_growth %d\n", req->idx_growth); |
616 | printk(KERN_ERR "\tdata_growth %d dd_growth %d\n", | 560 | pr_err("\tdata_growth %d dd_growth %d\n", |
617 | req->data_growth, req->dd_growth); | 561 | req->data_growth, req->dd_growth); |
618 | spin_unlock(&dbg_lock); | 562 | spin_unlock(&dbg_lock); |
619 | } | 563 | } |
@@ -621,14 +565,12 @@ void ubifs_dump_budget_req(const struct ubifs_budget_req *req) | |||
621 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) | 565 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) |
622 | { | 566 | { |
623 | spin_lock(&dbg_lock); | 567 | spin_lock(&dbg_lock); |
624 | printk(KERN_ERR "(pid %d) Lprops statistics: empty_lebs %d, " | 568 | pr_err("(pid %d) Lprops statistics: empty_lebs %d, idx_lebs %d\n", |
625 | "idx_lebs %d\n", current->pid, lst->empty_lebs, lst->idx_lebs); | 569 | current->pid, lst->empty_lebs, lst->idx_lebs); |
626 | printk(KERN_ERR "\ttaken_empty_lebs %d, total_free %lld, " | 570 | pr_err("\ttaken_empty_lebs %d, total_free %lld, total_dirty %lld\n", |
627 | "total_dirty %lld\n", lst->taken_empty_lebs, lst->total_free, | 571 | lst->taken_empty_lebs, lst->total_free, lst->total_dirty); |
628 | lst->total_dirty); | 572 | pr_err("\ttotal_used %lld, total_dark %lld, total_dead %lld\n", |
629 | printk(KERN_ERR "\ttotal_used %lld, total_dark %lld, " | 573 | lst->total_used, lst->total_dark, lst->total_dead); |
630 | "total_dead %lld\n", lst->total_used, lst->total_dark, | ||
631 | lst->total_dead); | ||
632 | spin_unlock(&dbg_lock); | 574 | spin_unlock(&dbg_lock); |
633 | } | 575 | } |
634 | 576 | ||
@@ -642,21 +584,17 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) | |||
642 | 584 | ||
643 | spin_lock(&c->space_lock); | 585 | spin_lock(&c->space_lock); |
644 | spin_lock(&dbg_lock); | 586 | spin_lock(&dbg_lock); |
645 | printk(KERN_ERR "(pid %d) Budgeting info: data budget sum %lld, " | 587 | pr_err("(pid %d) Budgeting info: data budget sum %lld, total budget sum %lld\n", |
646 | "total budget sum %lld\n", current->pid, | 588 | current->pid, bi->data_growth + bi->dd_growth, |
647 | bi->data_growth + bi->dd_growth, | ||
648 | bi->data_growth + bi->dd_growth + bi->idx_growth); | 589 | bi->data_growth + bi->dd_growth + bi->idx_growth); |
649 | printk(KERN_ERR "\tbudg_data_growth %lld, budg_dd_growth %lld, " | 590 | pr_err("\tbudg_data_growth %lld, budg_dd_growth %lld, budg_idx_growth %lld\n", |
650 | "budg_idx_growth %lld\n", bi->data_growth, bi->dd_growth, | 591 | bi->data_growth, bi->dd_growth, bi->idx_growth); |
651 | bi->idx_growth); | 592 | pr_err("\tmin_idx_lebs %d, old_idx_sz %llu, uncommitted_idx %lld\n", |
652 | printk(KERN_ERR "\tmin_idx_lebs %d, old_idx_sz %llu, " | 593 | bi->min_idx_lebs, bi->old_idx_sz, bi->uncommitted_idx); |
653 | "uncommitted_idx %lld\n", bi->min_idx_lebs, bi->old_idx_sz, | 594 | pr_err("\tpage_budget %d, inode_budget %d, dent_budget %d\n", |
654 | bi->uncommitted_idx); | ||
655 | printk(KERN_ERR "\tpage_budget %d, inode_budget %d, dent_budget %d\n", | ||
656 | bi->page_budget, bi->inode_budget, bi->dent_budget); | 595 | bi->page_budget, bi->inode_budget, bi->dent_budget); |
657 | printk(KERN_ERR "\tnospace %u, nospace_rp %u\n", | 596 | pr_err("\tnospace %u, nospace_rp %u\n", bi->nospace, bi->nospace_rp); |
658 | bi->nospace, bi->nospace_rp); | 597 | pr_err("\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n", |
659 | printk(KERN_ERR "\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n", | ||
660 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); | 598 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); |
661 | 599 | ||
662 | if (bi != &c->bi) | 600 | if (bi != &c->bi) |
@@ -667,38 +605,37 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) | |||
667 | */ | 605 | */ |
668 | goto out_unlock; | 606 | goto out_unlock; |
669 | 607 | ||
670 | printk(KERN_ERR "\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n", | 608 | pr_err("\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n", |
671 | c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt); | 609 | c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt); |
672 | printk(KERN_ERR "\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, " | 610 | pr_err("\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, clean_zn_cnt %ld\n", |
673 | "clean_zn_cnt %ld\n", atomic_long_read(&c->dirty_pg_cnt), | 611 | atomic_long_read(&c->dirty_pg_cnt), |
674 | atomic_long_read(&c->dirty_zn_cnt), | 612 | atomic_long_read(&c->dirty_zn_cnt), |
675 | atomic_long_read(&c->clean_zn_cnt)); | 613 | atomic_long_read(&c->clean_zn_cnt)); |
676 | printk(KERN_ERR "\tgc_lnum %d, ihead_lnum %d\n", | 614 | pr_err("\tgc_lnum %d, ihead_lnum %d\n", c->gc_lnum, c->ihead_lnum); |
677 | c->gc_lnum, c->ihead_lnum); | ||
678 | 615 | ||
679 | /* If we are in R/O mode, journal heads do not exist */ | 616 | /* If we are in R/O mode, journal heads do not exist */ |
680 | if (c->jheads) | 617 | if (c->jheads) |
681 | for (i = 0; i < c->jhead_cnt; i++) | 618 | for (i = 0; i < c->jhead_cnt; i++) |
682 | printk(KERN_ERR "\tjhead %s\t LEB %d\n", | 619 | pr_err("\tjhead %s\t LEB %d\n", |
683 | dbg_jhead(c->jheads[i].wbuf.jhead), | 620 | dbg_jhead(c->jheads[i].wbuf.jhead), |
684 | c->jheads[i].wbuf.lnum); | 621 | c->jheads[i].wbuf.lnum); |
685 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { | 622 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { |
686 | bud = rb_entry(rb, struct ubifs_bud, rb); | 623 | bud = rb_entry(rb, struct ubifs_bud, rb); |
687 | printk(KERN_ERR "\tbud LEB %d\n", bud->lnum); | 624 | pr_err("\tbud LEB %d\n", bud->lnum); |
688 | } | 625 | } |
689 | list_for_each_entry(bud, &c->old_buds, list) | 626 | list_for_each_entry(bud, &c->old_buds, list) |
690 | printk(KERN_ERR "\told bud LEB %d\n", bud->lnum); | 627 | pr_err("\told bud LEB %d\n", bud->lnum); |
691 | list_for_each_entry(idx_gc, &c->idx_gc, list) | 628 | list_for_each_entry(idx_gc, &c->idx_gc, list) |
692 | printk(KERN_ERR "\tGC'ed idx LEB %d unmap %d\n", | 629 | pr_err("\tGC'ed idx LEB %d unmap %d\n", |
693 | idx_gc->lnum, idx_gc->unmap); | 630 | idx_gc->lnum, idx_gc->unmap); |
694 | printk(KERN_ERR "\tcommit state %d\n", c->cmt_state); | 631 | pr_err("\tcommit state %d\n", c->cmt_state); |
695 | 632 | ||
696 | /* Print budgeting predictions */ | 633 | /* Print budgeting predictions */ |
697 | available = ubifs_calc_available(c, c->bi.min_idx_lebs); | 634 | available = ubifs_calc_available(c, c->bi.min_idx_lebs); |
698 | outstanding = c->bi.data_growth + c->bi.dd_growth; | 635 | outstanding = c->bi.data_growth + c->bi.dd_growth; |
699 | free = ubifs_get_free_space_nolock(c); | 636 | free = ubifs_get_free_space_nolock(c); |
700 | printk(KERN_ERR "Budgeting predictions:\n"); | 637 | pr_err("Budgeting predictions:\n"); |
701 | printk(KERN_ERR "\tavailable: %lld, outstanding %lld, free %lld\n", | 638 | pr_err("\tavailable: %lld, outstanding %lld, free %lld\n", |
702 | available, outstanding, free); | 639 | available, outstanding, free); |
703 | out_unlock: | 640 | out_unlock: |
704 | spin_unlock(&dbg_lock); | 641 | spin_unlock(&dbg_lock); |
@@ -718,21 +655,19 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
718 | dark = ubifs_calc_dark(c, spc); | 655 | dark = ubifs_calc_dark(c, spc); |
719 | 656 | ||
720 | if (lp->flags & LPROPS_INDEX) | 657 | if (lp->flags & LPROPS_INDEX) |
721 | printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " | 658 | pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d flags %#x (", |
722 | "free + dirty %-8d flags %#x (", lp->lnum, lp->free, | 659 | lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, |
723 | lp->dirty, c->leb_size - spc, spc, lp->flags); | 660 | lp->flags); |
724 | else | 661 | else |
725 | printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " | 662 | pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d flags %#-4x (", |
726 | "free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d " | 663 | lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, |
727 | "flags %#-4x (", lp->lnum, lp->free, lp->dirty, | 664 | dark, dead, (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags); |
728 | c->leb_size - spc, spc, dark, dead, | ||
729 | (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags); | ||
730 | 665 | ||
731 | if (lp->flags & LPROPS_TAKEN) { | 666 | if (lp->flags & LPROPS_TAKEN) { |
732 | if (lp->flags & LPROPS_INDEX) | 667 | if (lp->flags & LPROPS_INDEX) |
733 | printk(KERN_CONT "index, taken"); | 668 | pr_cont("index, taken"); |
734 | else | 669 | else |
735 | printk(KERN_CONT "taken"); | 670 | pr_cont("taken"); |
736 | } else { | 671 | } else { |
737 | const char *s; | 672 | const char *s; |
738 | 673 | ||
@@ -769,7 +704,7 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
769 | break; | 704 | break; |
770 | } | 705 | } |
771 | } | 706 | } |
772 | printk(KERN_CONT "%s", s); | 707 | pr_cont("%s", s); |
773 | } | 708 | } |
774 | 709 | ||
775 | for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) { | 710 | for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) { |
@@ -784,19 +719,18 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
784 | */ | 719 | */ |
785 | if (c->jheads && | 720 | if (c->jheads && |
786 | lp->lnum == c->jheads[i].wbuf.lnum) { | 721 | lp->lnum == c->jheads[i].wbuf.lnum) { |
787 | printk(KERN_CONT ", jhead %s", | 722 | pr_cont(", jhead %s", dbg_jhead(i)); |
788 | dbg_jhead(i)); | ||
789 | head = 1; | 723 | head = 1; |
790 | } | 724 | } |
791 | } | 725 | } |
792 | if (!head) | 726 | if (!head) |
793 | printk(KERN_CONT ", bud of jhead %s", | 727 | pr_cont(", bud of jhead %s", |
794 | dbg_jhead(bud->jhead)); | 728 | dbg_jhead(bud->jhead)); |
795 | } | 729 | } |
796 | } | 730 | } |
797 | if (lp->lnum == c->gc_lnum) | 731 | if (lp->lnum == c->gc_lnum) |
798 | printk(KERN_CONT ", GC LEB"); | 732 | pr_cont(", GC LEB"); |
799 | printk(KERN_CONT ")\n"); | 733 | pr_cont(")\n"); |
800 | } | 734 | } |
801 | 735 | ||
802 | void ubifs_dump_lprops(struct ubifs_info *c) | 736 | void ubifs_dump_lprops(struct ubifs_info *c) |
@@ -805,8 +739,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
805 | struct ubifs_lprops lp; | 739 | struct ubifs_lprops lp; |
806 | struct ubifs_lp_stats lst; | 740 | struct ubifs_lp_stats lst; |
807 | 741 | ||
808 | printk(KERN_ERR "(pid %d) start dumping LEB properties\n", | 742 | pr_err("(pid %d) start dumping LEB properties\n", current->pid); |
809 | current->pid); | ||
810 | ubifs_get_lp_stats(c, &lst); | 743 | ubifs_get_lp_stats(c, &lst); |
811 | ubifs_dump_lstats(&lst); | 744 | ubifs_dump_lstats(&lst); |
812 | 745 | ||
@@ -817,8 +750,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
817 | 750 | ||
818 | ubifs_dump_lprop(c, &lp); | 751 | ubifs_dump_lprop(c, &lp); |
819 | } | 752 | } |
820 | printk(KERN_ERR "(pid %d) finish dumping LEB properties\n", | 753 | pr_err("(pid %d) finish dumping LEB properties\n", current->pid); |
821 | current->pid); | ||
822 | } | 754 | } |
823 | 755 | ||
824 | void ubifs_dump_lpt_info(struct ubifs_info *c) | 756 | void ubifs_dump_lpt_info(struct ubifs_info *c) |
@@ -826,37 +758,36 @@ void ubifs_dump_lpt_info(struct ubifs_info *c) | |||
826 | int i; | 758 | int i; |
827 | 759 | ||
828 | spin_lock(&dbg_lock); | 760 | spin_lock(&dbg_lock); |
829 | printk(KERN_ERR "(pid %d) dumping LPT information\n", current->pid); | 761 | pr_err("(pid %d) dumping LPT information\n", current->pid); |
830 | printk(KERN_ERR "\tlpt_sz: %lld\n", c->lpt_sz); | 762 | pr_err("\tlpt_sz: %lld\n", c->lpt_sz); |
831 | printk(KERN_ERR "\tpnode_sz: %d\n", c->pnode_sz); | 763 | pr_err("\tpnode_sz: %d\n", c->pnode_sz); |
832 | printk(KERN_ERR "\tnnode_sz: %d\n", c->nnode_sz); | 764 | pr_err("\tnnode_sz: %d\n", c->nnode_sz); |
833 | printk(KERN_ERR "\tltab_sz: %d\n", c->ltab_sz); | 765 | pr_err("\tltab_sz: %d\n", c->ltab_sz); |
834 | printk(KERN_ERR "\tlsave_sz: %d\n", c->lsave_sz); | 766 | pr_err("\tlsave_sz: %d\n", c->lsave_sz); |
835 | printk(KERN_ERR "\tbig_lpt: %d\n", c->big_lpt); | 767 | pr_err("\tbig_lpt: %d\n", c->big_lpt); |
836 | printk(KERN_ERR "\tlpt_hght: %d\n", c->lpt_hght); | 768 | pr_err("\tlpt_hght: %d\n", c->lpt_hght); |
837 | printk(KERN_ERR "\tpnode_cnt: %d\n", c->pnode_cnt); | 769 | pr_err("\tpnode_cnt: %d\n", c->pnode_cnt); |
838 | printk(KERN_ERR "\tnnode_cnt: %d\n", c->nnode_cnt); | 770 | pr_err("\tnnode_cnt: %d\n", c->nnode_cnt); |
839 | printk(KERN_ERR "\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt); | 771 | pr_err("\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt); |
840 | printk(KERN_ERR "\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt); | 772 | pr_err("\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt); |
841 | printk(KERN_ERR "\tlsave_cnt: %d\n", c->lsave_cnt); | 773 | pr_err("\tlsave_cnt: %d\n", c->lsave_cnt); |
842 | printk(KERN_ERR "\tspace_bits: %d\n", c->space_bits); | 774 | pr_err("\tspace_bits: %d\n", c->space_bits); |
843 | printk(KERN_ERR "\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits); | 775 | pr_err("\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits); |
844 | printk(KERN_ERR "\tlpt_offs_bits: %d\n", c->lpt_offs_bits); | 776 | pr_err("\tlpt_offs_bits: %d\n", c->lpt_offs_bits); |
845 | printk(KERN_ERR "\tlpt_spc_bits: %d\n", c->lpt_spc_bits); | 777 | pr_err("\tlpt_spc_bits: %d\n", c->lpt_spc_bits); |
846 | printk(KERN_ERR "\tpcnt_bits: %d\n", c->pcnt_bits); | 778 | pr_err("\tpcnt_bits: %d\n", c->pcnt_bits); |
847 | printk(KERN_ERR "\tlnum_bits: %d\n", c->lnum_bits); | 779 | pr_err("\tlnum_bits: %d\n", c->lnum_bits); |
848 | printk(KERN_ERR "\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs); | 780 | pr_err("\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs); |
849 | printk(KERN_ERR "\tLPT head is at %d:%d\n", | 781 | pr_err("\tLPT head is at %d:%d\n", |
850 | c->nhead_lnum, c->nhead_offs); | 782 | c->nhead_lnum, c->nhead_offs); |
851 | printk(KERN_ERR "\tLPT ltab is at %d:%d\n", | 783 | pr_err("\tLPT ltab is at %d:%d\n", c->ltab_lnum, c->ltab_offs); |
852 | c->ltab_lnum, c->ltab_offs); | ||
853 | if (c->big_lpt) | 784 | if (c->big_lpt) |
854 | printk(KERN_ERR "\tLPT lsave is at %d:%d\n", | 785 | pr_err("\tLPT lsave is at %d:%d\n", |
855 | c->lsave_lnum, c->lsave_offs); | 786 | c->lsave_lnum, c->lsave_offs); |
856 | for (i = 0; i < c->lpt_lebs; i++) | 787 | for (i = 0; i < c->lpt_lebs; i++) |
857 | printk(KERN_ERR "\tLPT LEB %d free %d dirty %d tgc %d " | 788 | pr_err("\tLPT LEB %d free %d dirty %d tgc %d cmt %d\n", |
858 | "cmt %d\n", i + c->lpt_first, c->ltab[i].free, | 789 | i + c->lpt_first, c->ltab[i].free, c->ltab[i].dirty, |
859 | c->ltab[i].dirty, c->ltab[i].tgc, c->ltab[i].cmt); | 790 | c->ltab[i].tgc, c->ltab[i].cmt); |
860 | spin_unlock(&dbg_lock); | 791 | spin_unlock(&dbg_lock); |
861 | } | 792 | } |
862 | 793 | ||
@@ -865,13 +796,13 @@ void ubifs_dump_sleb(const struct ubifs_info *c, | |||
865 | { | 796 | { |
866 | struct ubifs_scan_node *snod; | 797 | struct ubifs_scan_node *snod; |
867 | 798 | ||
868 | printk(KERN_ERR "(pid %d) start dumping scanned data from LEB %d:%d\n", | 799 | pr_err("(pid %d) start dumping scanned data from LEB %d:%d\n", |
869 | current->pid, sleb->lnum, offs); | 800 | current->pid, sleb->lnum, offs); |
870 | 801 | ||
871 | list_for_each_entry(snod, &sleb->nodes, list) { | 802 | list_for_each_entry(snod, &sleb->nodes, list) { |
872 | cond_resched(); | 803 | cond_resched(); |
873 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", sleb->lnum, | 804 | pr_err("Dumping node at LEB %d:%d len %d\n", |
874 | snod->offs, snod->len); | 805 | sleb->lnum, snod->offs, snod->len); |
875 | ubifs_dump_node(c, snod->node); | 806 | ubifs_dump_node(c, snod->node); |
876 | } | 807 | } |
877 | } | 808 | } |
@@ -882,11 +813,7 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
882 | struct ubifs_scan_node *snod; | 813 | struct ubifs_scan_node *snod; |
883 | void *buf; | 814 | void *buf; |
884 | 815 | ||
885 | if (dbg_is_tst_rcvry(c)) | 816 | pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); |
886 | return; | ||
887 | |||
888 | printk(KERN_ERR "(pid %d) start dumping LEB %d\n", | ||
889 | current->pid, lnum); | ||
890 | 817 | ||
891 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 818 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
892 | if (!buf) { | 819 | if (!buf) { |
@@ -900,18 +827,17 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
900 | goto out; | 827 | goto out; |
901 | } | 828 | } |
902 | 829 | ||
903 | printk(KERN_ERR "LEB %d has %d nodes ending at %d\n", lnum, | 830 | pr_err("LEB %d has %d nodes ending at %d\n", lnum, |
904 | sleb->nodes_cnt, sleb->endpt); | 831 | sleb->nodes_cnt, sleb->endpt); |
905 | 832 | ||
906 | list_for_each_entry(snod, &sleb->nodes, list) { | 833 | list_for_each_entry(snod, &sleb->nodes, list) { |
907 | cond_resched(); | 834 | cond_resched(); |
908 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", lnum, | 835 | pr_err("Dumping node at LEB %d:%d len %d\n", lnum, |
909 | snod->offs, snod->len); | 836 | snod->offs, snod->len); |
910 | ubifs_dump_node(c, snod->node); | 837 | ubifs_dump_node(c, snod->node); |
911 | } | 838 | } |
912 | 839 | ||
913 | printk(KERN_ERR "(pid %d) finish dumping LEB %d\n", | 840 | pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum); |
914 | current->pid, lnum); | ||
915 | ubifs_scan_destroy(sleb); | 841 | ubifs_scan_destroy(sleb); |
916 | 842 | ||
917 | out: | 843 | out: |
@@ -932,33 +858,28 @@ void ubifs_dump_znode(const struct ubifs_info *c, | |||
932 | else | 858 | else |
933 | zbr = &c->zroot; | 859 | zbr = &c->zroot; |
934 | 860 | ||
935 | printk(KERN_ERR "znode %p, LEB %d:%d len %d parent %p iip %d level %d" | 861 | pr_err("znode %p, LEB %d:%d len %d parent %p iip %d level %d child_cnt %d flags %lx\n", |
936 | " child_cnt %d flags %lx\n", znode, zbr->lnum, zbr->offs, | 862 | znode, zbr->lnum, zbr->offs, zbr->len, znode->parent, znode->iip, |
937 | zbr->len, znode->parent, znode->iip, znode->level, | 863 | znode->level, znode->child_cnt, znode->flags); |
938 | znode->child_cnt, znode->flags); | ||
939 | 864 | ||
940 | if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) { | 865 | if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) { |
941 | spin_unlock(&dbg_lock); | 866 | spin_unlock(&dbg_lock); |
942 | return; | 867 | return; |
943 | } | 868 | } |
944 | 869 | ||
945 | printk(KERN_ERR "zbranches:\n"); | 870 | pr_err("zbranches:\n"); |
946 | for (n = 0; n < znode->child_cnt; n++) { | 871 | for (n = 0; n < znode->child_cnt; n++) { |
947 | zbr = &znode->zbranch[n]; | 872 | zbr = &znode->zbranch[n]; |
948 | if (znode->level > 0) | 873 | if (znode->level > 0) |
949 | printk(KERN_ERR "\t%d: znode %p LEB %d:%d len %d key " | 874 | pr_err("\t%d: znode %p LEB %d:%d len %d key %s\n", |
950 | "%s\n", n, zbr->znode, zbr->lnum, | 875 | n, zbr->znode, zbr->lnum, zbr->offs, zbr->len, |
951 | zbr->offs, zbr->len, | 876 | dbg_snprintf_key(c, &zbr->key, key_buf, |
952 | dbg_snprintf_key(c, &zbr->key, | 877 | DBG_KEY_BUF_LEN)); |
953 | key_buf, | ||
954 | DBG_KEY_BUF_LEN)); | ||
955 | else | 878 | else |
956 | printk(KERN_ERR "\t%d: LNC %p LEB %d:%d len %d key " | 879 | pr_err("\t%d: LNC %p LEB %d:%d len %d key %s\n", |
957 | "%s\n", n, zbr->znode, zbr->lnum, | 880 | n, zbr->znode, zbr->lnum, zbr->offs, zbr->len, |
958 | zbr->offs, zbr->len, | 881 | dbg_snprintf_key(c, &zbr->key, key_buf, |
959 | dbg_snprintf_key(c, &zbr->key, | 882 | DBG_KEY_BUF_LEN)); |
960 | key_buf, | ||
961 | DBG_KEY_BUF_LEN)); | ||
962 | } | 883 | } |
963 | spin_unlock(&dbg_lock); | 884 | spin_unlock(&dbg_lock); |
964 | } | 885 | } |
@@ -967,16 +888,16 @@ void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) | |||
967 | { | 888 | { |
968 | int i; | 889 | int i; |
969 | 890 | ||
970 | printk(KERN_ERR "(pid %d) start dumping heap cat %d (%d elements)\n", | 891 | pr_err("(pid %d) start dumping heap cat %d (%d elements)\n", |
971 | current->pid, cat, heap->cnt); | 892 | current->pid, cat, heap->cnt); |
972 | for (i = 0; i < heap->cnt; i++) { | 893 | for (i = 0; i < heap->cnt; i++) { |
973 | struct ubifs_lprops *lprops = heap->arr[i]; | 894 | struct ubifs_lprops *lprops = heap->arr[i]; |
974 | 895 | ||
975 | printk(KERN_ERR "\t%d. LEB %d hpos %d free %d dirty %d " | 896 | pr_err("\t%d. LEB %d hpos %d free %d dirty %d flags %d\n", |
976 | "flags %d\n", i, lprops->lnum, lprops->hpos, | 897 | i, lprops->lnum, lprops->hpos, lprops->free, |
977 | lprops->free, lprops->dirty, lprops->flags); | 898 | lprops->dirty, lprops->flags); |
978 | } | 899 | } |
979 | printk(KERN_ERR "(pid %d) finish dumping heap\n", current->pid); | 900 | pr_err("(pid %d) finish dumping heap\n", current->pid); |
980 | } | 901 | } |
981 | 902 | ||
982 | void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 903 | void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, |
@@ -984,15 +905,15 @@ void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
984 | { | 905 | { |
985 | int i; | 906 | int i; |
986 | 907 | ||
987 | printk(KERN_ERR "(pid %d) dumping pnode:\n", current->pid); | 908 | pr_err("(pid %d) dumping pnode:\n", current->pid); |
988 | printk(KERN_ERR "\taddress %zx parent %zx cnext %zx\n", | 909 | pr_err("\taddress %zx parent %zx cnext %zx\n", |
989 | (size_t)pnode, (size_t)parent, (size_t)pnode->cnext); | 910 | (size_t)pnode, (size_t)parent, (size_t)pnode->cnext); |
990 | printk(KERN_ERR "\tflags %lu iip %d level %d num %d\n", | 911 | pr_err("\tflags %lu iip %d level %d num %d\n", |
991 | pnode->flags, iip, pnode->level, pnode->num); | 912 | pnode->flags, iip, pnode->level, pnode->num); |
992 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { | 913 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { |
993 | struct ubifs_lprops *lp = &pnode->lprops[i]; | 914 | struct ubifs_lprops *lp = &pnode->lprops[i]; |
994 | 915 | ||
995 | printk(KERN_ERR "\t%d: free %d dirty %d flags %d lnum %d\n", | 916 | pr_err("\t%d: free %d dirty %d flags %d lnum %d\n", |
996 | i, lp->free, lp->dirty, lp->flags, lp->lnum); | 917 | i, lp->free, lp->dirty, lp->flags, lp->lnum); |
997 | } | 918 | } |
998 | } | 919 | } |
@@ -1002,20 +923,20 @@ void ubifs_dump_tnc(struct ubifs_info *c) | |||
1002 | struct ubifs_znode *znode; | 923 | struct ubifs_znode *znode; |
1003 | int level; | 924 | int level; |
1004 | 925 | ||
1005 | printk(KERN_ERR "\n"); | 926 | pr_err("\n"); |
1006 | printk(KERN_ERR "(pid %d) start dumping TNC tree\n", current->pid); | 927 | pr_err("(pid %d) start dumping TNC tree\n", current->pid); |
1007 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL); | 928 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL); |
1008 | level = znode->level; | 929 | level = znode->level; |
1009 | printk(KERN_ERR "== Level %d ==\n", level); | 930 | pr_err("== Level %d ==\n", level); |
1010 | while (znode) { | 931 | while (znode) { |
1011 | if (level != znode->level) { | 932 | if (level != znode->level) { |
1012 | level = znode->level; | 933 | level = znode->level; |
1013 | printk(KERN_ERR "== Level %d ==\n", level); | 934 | pr_err("== Level %d ==\n", level); |
1014 | } | 935 | } |
1015 | ubifs_dump_znode(c, znode); | 936 | ubifs_dump_znode(c, znode); |
1016 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); | 937 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); |
1017 | } | 938 | } |
1018 | printk(KERN_ERR "(pid %d) finish dumping TNC tree\n", current->pid); | 939 | pr_err("(pid %d) finish dumping TNC tree\n", current->pid); |
1019 | } | 940 | } |
1020 | 941 | ||
1021 | static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, | 942 | static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, |
@@ -1154,8 +1075,8 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) | |||
1154 | mutex_lock(&ui->ui_mutex); | 1075 | mutex_lock(&ui->ui_mutex); |
1155 | spin_lock(&ui->ui_lock); | 1076 | spin_lock(&ui->ui_lock); |
1156 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { | 1077 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { |
1157 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode " | 1078 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode is clean", |
1158 | "is clean", ui->ui_size, ui->synced_i_size); | 1079 | ui->ui_size, ui->synced_i_size); |
1159 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, | 1080 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, |
1160 | inode->i_mode, i_size_read(inode)); | 1081 | inode->i_mode, i_size_read(inode)); |
1161 | dump_stack(); | 1082 | dump_stack(); |
@@ -1217,17 +1138,16 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1217 | kfree(pdent); | 1138 | kfree(pdent); |
1218 | 1139 | ||
1219 | if (i_size_read(dir) != size) { | 1140 | if (i_size_read(dir) != size) { |
1220 | ubifs_err("directory inode %lu has size %llu, " | 1141 | ubifs_err("directory inode %lu has size %llu, but calculated size is %llu", |
1221 | "but calculated size is %llu", dir->i_ino, | 1142 | dir->i_ino, (unsigned long long)i_size_read(dir), |
1222 | (unsigned long long)i_size_read(dir), | ||
1223 | (unsigned long long)size); | 1143 | (unsigned long long)size); |
1224 | ubifs_dump_inode(c, dir); | 1144 | ubifs_dump_inode(c, dir); |
1225 | dump_stack(); | 1145 | dump_stack(); |
1226 | return -EINVAL; | 1146 | return -EINVAL; |
1227 | } | 1147 | } |
1228 | if (dir->i_nlink != nlink) { | 1148 | if (dir->i_nlink != nlink) { |
1229 | ubifs_err("directory inode %lu has nlink %u, but calculated " | 1149 | ubifs_err("directory inode %lu has nlink %u, but calculated nlink is %u", |
1230 | "nlink is %u", dir->i_ino, dir->i_nlink, nlink); | 1150 | dir->i_ino, dir->i_nlink, nlink); |
1231 | ubifs_dump_inode(c, dir); | 1151 | ubifs_dump_inode(c, dir); |
1232 | dump_stack(); | 1152 | dump_stack(); |
1233 | return -EINVAL; | 1153 | return -EINVAL; |
@@ -1686,8 +1606,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1686 | if (znode_cb) { | 1606 | if (znode_cb) { |
1687 | err = znode_cb(c, znode, priv); | 1607 | err = znode_cb(c, znode, priv); |
1688 | if (err) { | 1608 | if (err) { |
1689 | ubifs_err("znode checking function returned " | 1609 | ubifs_err("znode checking function returned error %d", |
1690 | "error %d", err); | 1610 | err); |
1691 | ubifs_dump_znode(c, znode); | 1611 | ubifs_dump_znode(c, znode); |
1692 | goto out_dump; | 1612 | goto out_dump; |
1693 | } | 1613 | } |
@@ -1697,9 +1617,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1697 | zbr = &znode->zbranch[idx]; | 1617 | zbr = &znode->zbranch[idx]; |
1698 | err = leaf_cb(c, zbr, priv); | 1618 | err = leaf_cb(c, zbr, priv); |
1699 | if (err) { | 1619 | if (err) { |
1700 | ubifs_err("leaf checking function " | 1620 | ubifs_err("leaf checking function returned error %d, for leaf at LEB %d:%d", |
1701 | "returned error %d, for leaf " | ||
1702 | "at LEB %d:%d", | ||
1703 | err, zbr->lnum, zbr->offs); | 1621 | err, zbr->lnum, zbr->offs); |
1704 | goto out_dump; | 1622 | goto out_dump; |
1705 | } | 1623 | } |
@@ -1807,8 +1725,8 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) | |||
1807 | } | 1725 | } |
1808 | 1726 | ||
1809 | if (calc != idx_size) { | 1727 | if (calc != idx_size) { |
1810 | ubifs_err("index size check failed: calculated size is %lld, " | 1728 | ubifs_err("index size check failed: calculated size is %lld, should be %lld", |
1811 | "should be %lld", calc, idx_size); | 1729 | calc, idx_size); |
1812 | dump_stack(); | 1730 | dump_stack(); |
1813 | return -EINVAL; | 1731 | return -EINVAL; |
1814 | } | 1732 | } |
@@ -2120,8 +2038,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2120 | fscki = read_add_inode(c, priv, inum); | 2038 | fscki = read_add_inode(c, priv, inum); |
2121 | if (IS_ERR(fscki)) { | 2039 | if (IS_ERR(fscki)) { |
2122 | err = PTR_ERR(fscki); | 2040 | err = PTR_ERR(fscki); |
2123 | ubifs_err("error %d while processing data node and " | 2041 | ubifs_err("error %d while processing data node and trying to find inode node %lu", |
2124 | "trying to find inode node %lu", | ||
2125 | err, (unsigned long)inum); | 2042 | err, (unsigned long)inum); |
2126 | goto out_dump; | 2043 | goto out_dump; |
2127 | } | 2044 | } |
@@ -2131,9 +2048,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2131 | blk_offs <<= UBIFS_BLOCK_SHIFT; | 2048 | blk_offs <<= UBIFS_BLOCK_SHIFT; |
2132 | blk_offs += le32_to_cpu(dn->size); | 2049 | blk_offs += le32_to_cpu(dn->size); |
2133 | if (blk_offs > fscki->size) { | 2050 | if (blk_offs > fscki->size) { |
2134 | ubifs_err("data node at LEB %d:%d is not within inode " | 2051 | ubifs_err("data node at LEB %d:%d is not within inode size %lld", |
2135 | "size %lld", zbr->lnum, zbr->offs, | 2052 | zbr->lnum, zbr->offs, fscki->size); |
2136 | fscki->size); | ||
2137 | err = -EINVAL; | 2053 | err = -EINVAL; |
2138 | goto out_dump; | 2054 | goto out_dump; |
2139 | } | 2055 | } |
@@ -2154,8 +2070,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2154 | fscki = read_add_inode(c, priv, inum); | 2070 | fscki = read_add_inode(c, priv, inum); |
2155 | if (IS_ERR(fscki)) { | 2071 | if (IS_ERR(fscki)) { |
2156 | err = PTR_ERR(fscki); | 2072 | err = PTR_ERR(fscki); |
2157 | ubifs_err("error %d while processing entry node and " | 2073 | ubifs_err("error %d while processing entry node and trying to find inode node %lu", |
2158 | "trying to find inode node %lu", | ||
2159 | err, (unsigned long)inum); | 2074 | err, (unsigned long)inum); |
2160 | goto out_dump; | 2075 | goto out_dump; |
2161 | } | 2076 | } |
@@ -2167,8 +2082,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2167 | fscki1 = read_add_inode(c, priv, inum); | 2082 | fscki1 = read_add_inode(c, priv, inum); |
2168 | if (IS_ERR(fscki1)) { | 2083 | if (IS_ERR(fscki1)) { |
2169 | err = PTR_ERR(fscki1); | 2084 | err = PTR_ERR(fscki1); |
2170 | ubifs_err("error %d while processing entry node and " | 2085 | ubifs_err("error %d while processing entry node and trying to find parent inode node %lu", |
2171 | "trying to find parent inode node %lu", | ||
2172 | err, (unsigned long)inum); | 2086 | err, (unsigned long)inum); |
2173 | goto out_dump; | 2087 | goto out_dump; |
2174 | } | 2088 | } |
@@ -2258,61 +2172,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd) | |||
2258 | */ | 2172 | */ |
2259 | if (fscki->inum != UBIFS_ROOT_INO && | 2173 | if (fscki->inum != UBIFS_ROOT_INO && |
2260 | fscki->references != 1) { | 2174 | fscki->references != 1) { |
2261 | ubifs_err("directory inode %lu has %d " | 2175 | ubifs_err("directory inode %lu has %d direntries which refer it, but should be 1", |
2262 | "direntries which refer it, but " | ||
2263 | "should be 1", | ||
2264 | (unsigned long)fscki->inum, | 2176 | (unsigned long)fscki->inum, |
2265 | fscki->references); | 2177 | fscki->references); |
2266 | goto out_dump; | 2178 | goto out_dump; |
2267 | } | 2179 | } |
2268 | if (fscki->inum == UBIFS_ROOT_INO && | 2180 | if (fscki->inum == UBIFS_ROOT_INO && |
2269 | fscki->references != 0) { | 2181 | fscki->references != 0) { |
2270 | ubifs_err("root inode %lu has non-zero (%d) " | 2182 | ubifs_err("root inode %lu has non-zero (%d) direntries which refer it", |
2271 | "direntries which refer it", | ||
2272 | (unsigned long)fscki->inum, | 2183 | (unsigned long)fscki->inum, |
2273 | fscki->references); | 2184 | fscki->references); |
2274 | goto out_dump; | 2185 | goto out_dump; |
2275 | } | 2186 | } |
2276 | if (fscki->calc_sz != fscki->size) { | 2187 | if (fscki->calc_sz != fscki->size) { |
2277 | ubifs_err("directory inode %lu size is %lld, " | 2188 | ubifs_err("directory inode %lu size is %lld, but calculated size is %lld", |
2278 | "but calculated size is %lld", | ||
2279 | (unsigned long)fscki->inum, | 2189 | (unsigned long)fscki->inum, |
2280 | fscki->size, fscki->calc_sz); | 2190 | fscki->size, fscki->calc_sz); |
2281 | goto out_dump; | 2191 | goto out_dump; |
2282 | } | 2192 | } |
2283 | if (fscki->calc_cnt != fscki->nlink) { | 2193 | if (fscki->calc_cnt != fscki->nlink) { |
2284 | ubifs_err("directory inode %lu nlink is %d, " | 2194 | ubifs_err("directory inode %lu nlink is %d, but calculated nlink is %d", |
2285 | "but calculated nlink is %d", | ||
2286 | (unsigned long)fscki->inum, | 2195 | (unsigned long)fscki->inum, |
2287 | fscki->nlink, fscki->calc_cnt); | 2196 | fscki->nlink, fscki->calc_cnt); |
2288 | goto out_dump; | 2197 | goto out_dump; |
2289 | } | 2198 | } |
2290 | } else { | 2199 | } else { |
2291 | if (fscki->references != fscki->nlink) { | 2200 | if (fscki->references != fscki->nlink) { |
2292 | ubifs_err("inode %lu nlink is %d, but " | 2201 | ubifs_err("inode %lu nlink is %d, but calculated nlink is %d", |
2293 | "calculated nlink is %d", | ||
2294 | (unsigned long)fscki->inum, | 2202 | (unsigned long)fscki->inum, |
2295 | fscki->nlink, fscki->references); | 2203 | fscki->nlink, fscki->references); |
2296 | goto out_dump; | 2204 | goto out_dump; |
2297 | } | 2205 | } |
2298 | } | 2206 | } |
2299 | if (fscki->xattr_sz != fscki->calc_xsz) { | 2207 | if (fscki->xattr_sz != fscki->calc_xsz) { |
2300 | ubifs_err("inode %lu has xattr size %u, but " | 2208 | ubifs_err("inode %lu has xattr size %u, but calculated size is %lld", |
2301 | "calculated size is %lld", | ||
2302 | (unsigned long)fscki->inum, fscki->xattr_sz, | 2209 | (unsigned long)fscki->inum, fscki->xattr_sz, |
2303 | fscki->calc_xsz); | 2210 | fscki->calc_xsz); |
2304 | goto out_dump; | 2211 | goto out_dump; |
2305 | } | 2212 | } |
2306 | if (fscki->xattr_cnt != fscki->calc_xcnt) { | 2213 | if (fscki->xattr_cnt != fscki->calc_xcnt) { |
2307 | ubifs_err("inode %lu has %u xattrs, but " | 2214 | ubifs_err("inode %lu has %u xattrs, but calculated count is %lld", |
2308 | "calculated count is %lld", | ||
2309 | (unsigned long)fscki->inum, | 2215 | (unsigned long)fscki->inum, |
2310 | fscki->xattr_cnt, fscki->calc_xcnt); | 2216 | fscki->xattr_cnt, fscki->calc_xcnt); |
2311 | goto out_dump; | 2217 | goto out_dump; |
2312 | } | 2218 | } |
2313 | if (fscki->xattr_nms != fscki->calc_xnms) { | 2219 | if (fscki->xattr_nms != fscki->calc_xnms) { |
2314 | ubifs_err("inode %lu has xattr names' size %u, but " | 2220 | ubifs_err("inode %lu has xattr names' size %u, but calculated names' size is %lld", |
2315 | "calculated names' size is %lld", | ||
2316 | (unsigned long)fscki->inum, fscki->xattr_nms, | 2221 | (unsigned long)fscki->inum, fscki->xattr_nms, |
2317 | fscki->calc_xnms); | 2222 | fscki->calc_xnms); |
2318 | goto out_dump; | 2223 | goto out_dump; |
@@ -2652,20 +2557,18 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2652 | return 1; | 2557 | return 1; |
2653 | } | 2558 | } |
2654 | 2559 | ||
2655 | static void cut_data(const void *buf, unsigned int len) | 2560 | static int corrupt_data(const struct ubifs_info *c, const void *buf, |
2561 | unsigned int len) | ||
2656 | { | 2562 | { |
2657 | unsigned int from, to, i, ffs = chance(1, 2); | 2563 | unsigned int from, to, i, ffs = chance(1, 2); |
2658 | unsigned char *p = (void *)buf; | 2564 | unsigned char *p = (void *)buf; |
2659 | 2565 | ||
2660 | from = random32() % (len + 1); | 2566 | from = random32() % (len + 1); |
2661 | if (chance(1, 2)) | 2567 | /* Corruption may only span one max. write unit */ |
2662 | to = random32() % (len - from + 1); | 2568 | to = min(len, ALIGN(from, c->max_write_size)); |
2663 | else | ||
2664 | to = len; | ||
2665 | 2569 | ||
2666 | if (from < to) | 2570 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, |
2667 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, | 2571 | ffs ? "0xFFs" : "random data"); |
2668 | ffs ? "0xFFs" : "random data"); | ||
2669 | 2572 | ||
2670 | if (ffs) | 2573 | if (ffs) |
2671 | for (i = from; i < to; i++) | 2574 | for (i = from; i < to; i++) |
@@ -2673,6 +2576,8 @@ static void cut_data(const void *buf, unsigned int len) | |||
2673 | else | 2576 | else |
2674 | for (i = from; i < to; i++) | 2577 | for (i = from; i < to; i++) |
2675 | p[i] = random32() % 0x100; | 2578 | p[i] = random32() % 0x100; |
2579 | |||
2580 | return to; | ||
2676 | } | 2581 | } |
2677 | 2582 | ||
2678 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | 2583 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, |
@@ -2685,7 +2590,9 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2685 | 2590 | ||
2686 | failing = power_cut_emulated(c, lnum, 1); | 2591 | failing = power_cut_emulated(c, lnum, 1); |
2687 | if (failing) | 2592 | if (failing) |
2688 | cut_data(buf, len); | 2593 | len = corrupt_data(c, buf, len); |
2594 | ubifs_warn("actually write %d bytes to LEB %d:%d (the buffer was corrupted)", | ||
2595 | len, lnum, offs); | ||
2689 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); | 2596 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
2690 | if (err) | 2597 | if (err) |
2691 | return err; | 2598 | return err; |