diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-07-27 11:56:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-07-27 11:56:40 -0400 |
commit | c398eda0e43a791be0fca6f197a1e2bbb9f16070 (patch) | |
tree | d7b2b95490f96a75e116a3aa13c17767aa630342 /fs/ext4/super.c | |
parent | 60fd4da34d55a9cc0d857fc76dc12cf8cab4ed02 (diff) |
ext4: Pass line numbers to ext4_error() and friends
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 87db5ecfccb4..bcf74b31d014 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -262,7 +262,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) | |||
262 | * that sync() will call the filesystem's write_super callback if | 262 | * that sync() will call the filesystem's write_super callback if |
263 | * appropriate. | 263 | * appropriate. |
264 | */ | 264 | */ |
265 | int __ext4_journal_stop(const char *where, handle_t *handle) | 265 | int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle) |
266 | { | 266 | { |
267 | struct super_block *sb; | 267 | struct super_block *sb; |
268 | int err; | 268 | int err; |
@@ -279,7 +279,7 @@ int __ext4_journal_stop(const char *where, handle_t *handle) | |||
279 | if (!err) | 279 | if (!err) |
280 | err = rc; | 280 | err = rc; |
281 | if (err) | 281 | if (err) |
282 | __ext4_std_error(sb, where, err); | 282 | __ext4_std_error(sb, where, line, err); |
283 | return err; | 283 | return err; |
284 | } | 284 | } |
285 | 285 | ||
@@ -350,12 +350,13 @@ static void ext4_handle_error(struct super_block *sb) | |||
350 | } | 350 | } |
351 | 351 | ||
352 | void __ext4_error(struct super_block *sb, const char *function, | 352 | void __ext4_error(struct super_block *sb, const char *function, |
353 | const char *fmt, ...) | 353 | unsigned int line, const char *fmt, ...) |
354 | { | 354 | { |
355 | va_list args; | 355 | va_list args; |
356 | 356 | ||
357 | va_start(args, fmt); | 357 | va_start(args, fmt); |
358 | printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function); | 358 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: ", |
359 | sb->s_id, function, line, current->comm); | ||
359 | vprintk(fmt, args); | 360 | vprintk(fmt, args); |
360 | printk("\n"); | 361 | printk("\n"); |
361 | va_end(args); | 362 | va_end(args); |
@@ -363,14 +364,18 @@ void __ext4_error(struct super_block *sb, const char *function, | |||
363 | ext4_handle_error(sb); | 364 | ext4_handle_error(sb); |
364 | } | 365 | } |
365 | 366 | ||
366 | void ext4_error_inode(const char *function, struct inode *inode, | 367 | void ext4_error_inode(struct inode *inode, const char *function, |
368 | unsigned int line, ext4_fsblk_t block, | ||
367 | const char *fmt, ...) | 369 | const char *fmt, ...) |
368 | { | 370 | { |
369 | va_list args; | 371 | va_list args; |
370 | 372 | ||
371 | va_start(args, fmt); | 373 | va_start(args, fmt); |
372 | printk(KERN_CRIT "EXT4-fs error (device %s): %s: inode #%lu: (comm %s) ", | 374 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: inode #%lu: ", |
373 | inode->i_sb->s_id, function, inode->i_ino, current->comm); | 375 | inode->i_sb->s_id, function, line, inode->i_ino); |
376 | if (block) | ||
377 | printk("block %llu: ", block); | ||
378 | printk("comm %s: ", current->comm); | ||
374 | vprintk(fmt, args); | 379 | vprintk(fmt, args); |
375 | printk("\n"); | 380 | printk("\n"); |
376 | va_end(args); | 381 | va_end(args); |
@@ -378,8 +383,8 @@ void ext4_error_inode(const char *function, struct inode *inode, | |||
378 | ext4_handle_error(inode->i_sb); | 383 | ext4_handle_error(inode->i_sb); |
379 | } | 384 | } |
380 | 385 | ||
381 | void ext4_error_file(const char *function, struct file *file, | 386 | void ext4_error_file(struct file *file, const char *function, |
382 | const char *fmt, ...) | 387 | unsigned int line, const char *fmt, ...) |
383 | { | 388 | { |
384 | va_list args; | 389 | va_list args; |
385 | struct inode *inode = file->f_dentry->d_inode; | 390 | struct inode *inode = file->f_dentry->d_inode; |
@@ -390,8 +395,10 @@ void ext4_error_file(const char *function, struct file *file, | |||
390 | if (!path) | 395 | if (!path) |
391 | path = "(unknown)"; | 396 | path = "(unknown)"; |
392 | printk(KERN_CRIT | 397 | printk(KERN_CRIT |
393 | "EXT4-fs error (device %s): %s: inode #%lu (comm %s path %s): ", | 398 | "EXT4-fs error (device %s): %s:%d: inode #%lu " |
394 | inode->i_sb->s_id, function, inode->i_ino, current->comm, path); | 399 | "(comm %s path %s): ", |
400 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
401 | current->comm, path); | ||
395 | vprintk(fmt, args); | 402 | vprintk(fmt, args); |
396 | printk("\n"); | 403 | printk("\n"); |
397 | va_end(args); | 404 | va_end(args); |
@@ -436,7 +443,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno, | |||
436 | /* __ext4_std_error decodes expected errors from journaling functions | 443 | /* __ext4_std_error decodes expected errors from journaling functions |
437 | * automatically and invokes the appropriate error response. */ | 444 | * automatically and invokes the appropriate error response. */ |
438 | 445 | ||
439 | void __ext4_std_error(struct super_block *sb, const char *function, int errno) | 446 | void __ext4_std_error(struct super_block *sb, const char *function, |
447 | unsigned int line, int errno) | ||
440 | { | 448 | { |
441 | char nbuf[16]; | 449 | char nbuf[16]; |
442 | const char *errstr; | 450 | const char *errstr; |
@@ -449,8 +457,8 @@ void __ext4_std_error(struct super_block *sb, const char *function, int errno) | |||
449 | return; | 457 | return; |
450 | 458 | ||
451 | errstr = ext4_decode_error(sb, errno, nbuf); | 459 | errstr = ext4_decode_error(sb, errno, nbuf); |
452 | printk(KERN_CRIT "EXT4-fs error (device %s) in %s: %s\n", | 460 | printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n", |
453 | sb->s_id, function, errstr); | 461 | sb->s_id, function, line, errstr); |
454 | 462 | ||
455 | ext4_handle_error(sb); | 463 | ext4_handle_error(sb); |
456 | } | 464 | } |
@@ -466,12 +474,13 @@ void __ext4_std_error(struct super_block *sb, const char *function, int errno) | |||
466 | */ | 474 | */ |
467 | 475 | ||
468 | void __ext4_abort(struct super_block *sb, const char *function, | 476 | void __ext4_abort(struct super_block *sb, const char *function, |
469 | const char *fmt, ...) | 477 | unsigned int line, const char *fmt, ...) |
470 | { | 478 | { |
471 | va_list args; | 479 | va_list args; |
472 | 480 | ||
473 | va_start(args, fmt); | 481 | va_start(args, fmt); |
474 | printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function); | 482 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id, |
483 | function, line); | ||
475 | vprintk(fmt, args); | 484 | vprintk(fmt, args); |
476 | printk("\n"); | 485 | printk("\n"); |
477 | va_end(args); | 486 | va_end(args); |
@@ -503,13 +512,13 @@ void ext4_msg (struct super_block * sb, const char *prefix, | |||
503 | } | 512 | } |
504 | 513 | ||
505 | void __ext4_warning(struct super_block *sb, const char *function, | 514 | void __ext4_warning(struct super_block *sb, const char *function, |
506 | const char *fmt, ...) | 515 | unsigned int line, const char *fmt, ...) |
507 | { | 516 | { |
508 | va_list args; | 517 | va_list args; |
509 | 518 | ||
510 | va_start(args, fmt); | 519 | va_start(args, fmt); |
511 | printk(KERN_WARNING "EXT4-fs warning (device %s): %s: ", | 520 | printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: ", |
512 | sb->s_id, function); | 521 | sb->s_id, function, line); |
513 | vprintk(fmt, args); | 522 | vprintk(fmt, args); |
514 | printk("\n"); | 523 | printk("\n"); |
515 | va_end(args); | 524 | va_end(args); |